node icon indicating copy to clipboard operation
node copied to clipboard

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

Open comcalvi opened this issue 9 months ago • 0 comments

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

comcalvi avatar May 08 '24 05:05 comcalvi