简体   繁体   English

无法安装任何npm软件包

[英]Can't install any npm packages

I can't install any npm packages. 我无法安装任何npm软件包。 I type in npm install lodash and I get: 我输入npm install lodash ,我得到:

npm WARN webdev@1.0.0 No description
npm WARN webdev@1.0.0 No repository field.

npm ERR! path C:\Users\Blake\Desktop\webdev\node_modules\lodash
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Blake\Desktop\webdev\node_modules\lodash' -> 'C:\Users\Blake\Desktop\webdev\node_modules\.lodash.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Blake\AppData\Roaming\npm-cache\_logs\2018-03-15T21_28_45_978Z-debug.log

My package.json file looks like: 我的package.json文件如下所示:

{
  "name": "webdev",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {},
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

I'm not sure what is wrong. 我不知道怎么了。 I've tried uninstalling and reinstalling node.js. 我尝试卸载并重新安装node.js。 My npm version is 5.6.0. 我的npm版本是5.6.0。 This happens with every package I've tried to install. 我尝试安装的每个软件包都会发生这种情况。 Please help, I've been trying to fix this for hours to no avail. 请帮忙,我已经尝试修复了好几个小时,但都无济于事。

EDIT: I fixed it! 编辑:我解决了! The absolute nightmare of a program, MalwareBytes Antimalware was blocking it. 程序的绝对噩梦,MalwareBytes Antimalware阻止了它。 I quit out of MalwareBytes and now it is working. 我退出了MalwareBytes,现在可以使用了。 Not the first time that program has messed up my coding. 该程序不是第一次弄乱我的编码。

Delete package.json and package-lock.json file, use npm init and try again. 删除package.json和package-lock.json文件,使用npm init并重试。

Probably directory node_modules doesnt exist in your project working directory 项目工作目录中可能不存在目录node_modules

I would make sure you have npm installed locally in your working directory by running npm init. 我将通过运行npm init来确保在工作目录中本地安装了npm。 I would also try re-installing npm. 我还将尝试重新安装npm。

EDIT: 编辑:

Remove MalwareBytes Anti-Malware. 删除MalwareBytes反恶意软件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM