Skip to content

Regression in 20.13.0 for Windows users - NPM not installed with node #52884

Closed
@comcalvi

Description

@comcalvi

Version

20.13.0

Platform

Windows

Subsystem

No response

What steps will reproduce the bug?

Install Node from chocolatey:

C:\\ProgramData\\chocolatey\\bin\\choco.exe upgrade nodejs-lts -y

(the output confirms the node version is 20.13.0):

Version 20.13.0 is available based on your source(s).

Then run an npm command:

npm init -y

This fails with:

Error: Cannot find module 'C:\Users\ContainerAdministrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

I was able to fix this by pinning the version to 20.12.2:

C:\\ProgramData\\chocolatey\\bin\\choco.exe upgrade nodejs-lts -y --version 20.12.2

This only broke our Windows build, confirmed it did not affect Ubuntu.

How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior? Why is that the expected behavior?

NPM CLI should be available for Windows users

What do you see instead?

Error: Cannot find module 'C:\Users\ContainerAdministrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    npmIssues and PRs related to the npm client dependency or the npm registry.v20.xIssues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions