Skip to content

ci: run lerna via npx in the nightly ci and e2e steps - #1261

Merged
Ewerton Scaboro da Silva (ewertons) merged 1 commit into
mainfrom
ewertons/ci-npx-lerna
Aug 10, 2026
Merged

ci: run lerna via npx in the nightly ci and e2e steps#1261
Ewerton Scaboro da Silva (ewertons) merged 1 commit into
mainfrom
ewertons/ci-npx-lerna

Conversation

@ewertons

Copy link
Copy Markdown
Contributor

What failed

Nightly node-eastus-windows build 161589 failed in stage build_and_tests, job Windows Node 18.x, step Unit & Integration Tests (Cmd.exe exited with code '1'). No tests ran at all; E2E Tests and everything downstream were skipped.

C:\npm\prefix\node_modules\lerna\node_modules\import-local\index.js:8
        const normalizedFilename = filename.startsWith('file://') ? fileURLToPath(filename) : filename;
                                            ^
TypeError: Cannot read properties of undefined (reading 'startsWith')
    at module.exports (C:\npm\prefix\node_modules\lerna\node_modules\import-local\index.js:8:38)
    at file:///C:/npm/prefix/node_modules/lerna/dist/cli.js:7:5
Node.js v18.20.8

Root cause

The step invoked bare call lerna run ci. On the hosted windows-latest image that resolves the globally preinstalled lerna at C:\npm\prefix\node_modules\lerna rather than the repo's lerna@9.0.7, and that global copy crashes under Node 18.

The preceding Build step in the same job passed, because it already uses npx lerna run build:

call npx lerna run build
lerna notice cli v9.0.7
Lerna (powered by Nx)   Successfully ran target build for 21 projects

The Node 18 / lerna 9 migration converted the build invocation to npx but missed ci and e2e.

Fix

Use npx for the ci and e2e steps so the repo-local lerna is always the one that runs.

  • vsts/node-nightly-windows.yaml - call lerna run ci -> call npx lerna run ci, lerna run e2e -> call npx lerna run e2e. The e2e step would have failed identically as soon as ci was unblocked.
  • vsts/node-nightly-linux.yaml - same two changes. Linux is green today only because that image's global lerna happens to be 9.0.7, so the same latent breakage is present there and invisible.

Verified locally that npx lerna --version resolves to 9.0.7 from the root devDependency.

Out of scope

vsts/node-nightly-df.yaml and vsts/e2e-debug-loop.yaml contain the same bare-lerna pattern (and e2e-debug-loop.yaml still calls lerna bootstrap --hoist, removed in lerna 9), but those pipelines need broader work to bring back to life and are intentionally left alone here.

The Unit & Integration Tests step invoked bare 'lerna run ci', which on the hosted windows-latest image resolves the globally preinstalled lerna at C:\npm\prefix\node_modules\lerna instead of the repo's lerna 9.0.7. That global copy crashes on Node 18 with 'TypeError: Cannot read properties of undefined (reading startsWith)' in import-local, so no tests ran and the job failed (build 161589).

The Build step already used 'npx lerna run build' and passed; the Node 18 / lerna 9 migration missed the ci and e2e invocations. Switch both to npx so the repo-local lerna is always used. Linux is green only because that image's global lerna happens to match, so apply the same change there.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes nightly CI failures caused by invoking a globally preinstalled lerna on hosted agents (notably windows-latest), by ensuring the pipelines always execute the repo-local Lerna via npx.

Changes:

  • Update Windows nightly pipeline to run ci and e2e via call npx lerna ... to avoid the global Lerna on hosted agents.
  • Update Linux nightly pipeline to run ci and e2e via npx lerna ... for consistent behavior across images.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
vsts/node-nightly-windows.yaml Switches ci/e2e steps to call npx lerna ... to force the repo-local Lerna on Windows agents.
vsts/node-nightly-linux.yaml Switches ci/e2e steps to npx lerna ... to avoid latent reliance on a globally installed Lerna.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ewertons
Ewerton Scaboro da Silva (ewertons) merged commit d718645 into main Aug 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants