[英]How to install back the npm module in Node.js
今天想通过NPM下载一个模块。
想,因为 Node.js 找不到我安装的 NPM 模块,也许,我需要通过管理员 PowerShell 在文件夹C:\Program Files\nodejs\node_modules
。 所以,做到了,运行命令:
npm i node-red-contrib-mihome
不知何故,它起作用了,但是随后,任何其他 NPM 安装都没有启动。 那是因为这个错误:
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v17.2.0
现在, node_modules
文件夹中没有npm
模块。
如何取回?
谢谢@Anis的回答。
Next
,然后单击“ Repair
”。Repair
并等待Finish
现在您应该拥有C:\Program Files\nodejs\node_modules\npm
模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.