npm\bin\npm-cli.js 在 WSL2 Ubuntu 上找不到
npm\bin\npm-cli.js not found on WSL2 Ubuntu
我在 Windows 10
上使用 WSL2 (Ubuntu) 时遇到 npm 和 JHipster 的奇怪问题
在 WSL2 上启动 ./mvnw 时出现以下错误
[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] }
但如果我手动启动 npm run cleanup && npm run webpack:build:main
工作正常
我发现的关于“找不到模块 'node\node_modules\npm\bin\npm-cli.js'”的 Al 参考文献是关于 运行 npm on Windows 10 而不是 运行 npm on WSL2。
有什么想法吗?
$ node --version
v14.16.0
$ npm --version
6.14.11
已修复。
问题是 WSL 中的 运行 npm 和 Windows。它会导致本地节点和 node_modules 文件夹出现问题
清理文件夹后
rm -rf node
rm -rf node_modules
它在 WSL2 中再次工作。
我在 Windows 10
上使用 WSL2 (Ubuntu) 时遇到 npm 和 JHipster 的奇怪问题在 WSL2 上启动 ./mvnw 时出现以下错误
[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] }
但如果我手动启动 npm run cleanup && npm run webpack:build:main
工作正常
我发现的关于“找不到模块 'node\node_modules\npm\bin\npm-cli.js'”的 Al 参考文献是关于 运行 npm on Windows 10 而不是 运行 npm on WSL2。
有什么想法吗?
$ node --version
v14.16.0
$ npm --version
6.14.11
已修复。 问题是 WSL 中的 运行 npm 和 Windows。它会导致本地节点和 node_modules 文件夹出现问题 清理文件夹后
rm -rf node
rm -rf node_modules
它在 WSL2 中再次工作。