[英]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.