[英]Why is npm install not installing packages into /node_modules folder?
When I npm install package, npm says that it successfully installed the package, but when I look for it in the node_modules folder, the package is not in the folder. When I npm install -g package, the package gets installed into the global /node_modules folder, so I have to drag the package from the global folder to the local folder.
為什么 npm 安裝沒有安裝到我的本地 /node_modules 文件夾中?
如here所述,您可以采取一些措施來解決此問題。
首先,嘗試刪除您的package-lock.json
文件。 如果您運行npm install
或npm i
之后,它應該生成一個全新的安裝,而不參考現有的package-lock.json
文件。
如果這不起作用,請嘗試刪除項目中的node_modules
目錄。 然后運行npm install
或npm i
。
如果這不起作用,您應該嘗試刪除node_modules
目錄和package-lock.json
。 然后運行npm install
或npm i
。 這應該可以解決問題。
步驟 1) rm -rf./node_modules
從您的根目錄。
步驟 2) npm install
。
上述命令首先刪除您的 node_modules,然后重新安裝在 package.json 中找到的所有包。
這是我面臨的同樣問題,上述兩個命令都解決了我的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.