NodeJS 错误:找不到模块“C:\用户\nguye\应用程序数据\本地\节点\节点模块\npm\bin\npm-cli.js”

am46iovg  于 2022-12-18  发布在  Node.js
关注(0)|答案(2)|浏览(362)

嗯,我安装了一个过时的软件包,我...打破了npm.错误:

node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module 'C:\Users\nguye\AppData\Local\nodejs\node_modules\npm\bin\npm-cli.js'
←[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:804:27)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m    at node:internal/main/run_main_module:17:47←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: []

当我试着去弥补的时候,事情发生了:(我使用的是Node.js 16.17.0 LTS)

>npm i npm-cli --save
node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module 'C:\Users\nguye\AppData\Local\nodejs\node_modules\npm\bin\npm-cli.js'
←[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:804:27)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m    at node:internal/main/run_main_module:17:47←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: []
}
pgvzfuti

pgvzfuti1#

Uninstall node and npm, and reinstall。这可能会在您的系统中正确设置路径。

z18hc3ub

z18hc3ub2#

1.删除node_modules目录
1.删除package-lock.json文件
1.运行npm安装
1.运行npm start或npm run dev

相关问题