Skip to content

tfx Error [ERR_REQUIRE_ESM]: require() of ES Module #491

@maasha

Description

@maasha

Our build pipeline started to fail.

The job:

  - job: BUILD_DEV_EXTENSION_JOB_1
    displayName: "Build Dev Extension Job 1"
    steps:
      - task: TfxInstaller@4
        inputs:
          version: "v0.x"
        displayName: "Install tfx"

The log:

2025-02-03T18:20:04.3270401Z ##[section]Starting: Install tfx
2025-02-03T18:20:04.3277999Z ==============================================================================
2025-02-03T18:20:04.3278293Z Task : Use Node CLI for Azure DevOps (tfx-cli)
2025-02-03T18:20:04.3278475Z Description : Installs the Node CLI for Azure DevOps (tfx-cli) on your agent.
2025-02-03T18:20:04.3278691Z Version : 4.4.357
2025-02-03T18:20:04.3278853Z Author : Microsoft Corporation
2025-02-03T18:20:04.3279301Z Help :
2025-02-03T18:20:04.3279449Z ==============================================================================
2025-02-03T18:20:19.4083652Z Caching tool: tfx 0.19.0 x64
2025-02-03T18:20:20.4737784Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/tfx/0.19.0/x64/bin
2025-02-03T18:20:20.4742669Z [command]/opt/hostedtoolcache/tfx/0.19.0/x64/bin/tfx version --no-color
2025-02-03T18:20:20.8602599Z error: /opt/hostedtoolcache/tfx/0.19.0/x64/lib/node_modules/tfx-cli/_build/exec/version could not be fully loaded as a tfx command.
2025-02-03T18:20:20.8612599Z error: Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/hostedtoolcache/tfx/0.19.0/x64/lib/node_modules/tfx-cli/node_modules/clipboardy/index.js from /opt/hostedtoolcache/tfx/0.19.0/x64/lib/node_modules/tfx-cli/_build/lib/tfcommand.js not supported.
2025-02-03T18:20:20.8613675Z error: Instead change the require of index.js in /opt/hostedtoolcache/tfx/0.19.0/x64/lib/node_modules/tfx-cli/_build/lib/tfcommand.js to a dynamic import() which is available in all CommonJS modules.
2025-02-03T18:20:20.8712026Z ##[error]The process '/opt/hostedtoolcache/tfx/0.19.0/x64/bin/tfx' failed with exit code 255
2025-02-03T18:20:20.8768539Z ##[section]Finishing: Install tfx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions