0

I have a weird issue with npm and JHipster using WSL2 (Ubuntu) over Windows 10

Launching ./mvnw on WSL2 give me the following error

[INFO] > npm run cleanup && npm run webpack:build:main
[INFO]
[INFO] internal/modules/cjs/loader.js:985
[INFO]   throw err;
[INFO]   ^
[INFO]
[INFO] Error: Cannot find module 'C:\mnt\c\jhipster\demo\node\node_modules\npm\bin\npm-cli.js'
[INFO]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
[INFO]     at Function.Module._load (internal/modules/cjs/loader.js:864:27)
[INFO]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
[INFO]     at internal/main/run_main_module.js:18:47 {
[INFO]   code: 'MODULE_NOT_FOUND',
[INFO]   requireStack: []
[INFO] }

But if I launch by hand npm run cleanup && npm run webpack:build:main is working fine

Al references that I found about "Cannot find module 'node\node_modules\npm\bin\npm-cli.js'" are about running npm on Windows 10 not running npm on WSL2.

Any ideas?

$ node --version
v14.16.0

$ npm --version
6.14.11
Carlos Garces
  • 829
  • 1
  • 11
  • 24

1 Answers1

0

Fixed. The problem was run npm in WSL and Windows. It cause problems in the local node and node_modules folders After cleanup the folder

rm -rf node
rm -rf node_modules

It works again from WSL2.

Carlos Garces
  • 829
  • 1
  • 11
  • 24