Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Windows npx looking in node_modules/node_modules #7466

Closed
2 tasks done
charlesritchea opened this issue May 3, 2024 · 3 comments
Closed
2 tasks done

[BUG] Windows npx looking in node_modules/node_modules #7466

charlesritchea opened this issue May 3, 2024 · 3 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x

Comments

@charlesritchea
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

yarn run v1.22.22
$ cross-env NODE_ENV=development yarn _webpack
$ npx --node-options='--max_old_space_size=8192' webpack
node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module 'C:\Users\User\wireframe-tool\node_modules\node_modules\webpack\bin\webpack.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.12.2

Expected Behavior

It should obviously be looking for webpack.js at C:\Users\User\wireframe-tool\node_modules\webpack\bin\webpack.js

Steps To Reproduce

  1. In Windows, powershell/git bash doesn't matter
  2. With yarn 1.x workspaces with a webpack 5 workspace (not the root of course)
  3. Run yarn workspace @foo/bar run

Environment

  • npm: 10.5.0
  • Node.js: v20.12.2
  • OS Name: Windows 11
  • System Model Name:
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\User\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.12.2
; npm local prefix = C:\Users\User\wireframe-tool
; npm version = 10.5.0
; cwd = C:\Users\User\wireframe-tool
; HOME = C:\Users\User
; Run `npm config ls -l` to show all defaults.
@charlesritchea charlesritchea added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels May 3, 2024
@charlesritchea charlesritchea changed the title [BUG] Windows npx webpack looking in node_modules/node_modules/webpack [BUG] Windows npx looking in node_modules/node_modules May 3, 2024
@charlesritchea
Copy link
Author

Very strange. I get the same error if I swap out webpack for ng, but it is able to resolve jest. I also tried multiple npm versions including 9.x and it reproduces in all of them, so I don't think it's a regression on the npm side. No idea what suddenly caused this change.

@wraithgar
Copy link
Member

This does not appear to be a bug in npm.

@charlesritchea
Copy link
Author

charlesritchea commented May 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x
Projects
None yet
Development

No branches or pull requests

2 participants