node.js - npm 安装失败,错误 : EPERM: operation not permitted, 取消链接 '\node_modules'

标签 node.js angularjs windows-10 npm-install

我尝试在 CMD 中运行“npm install”命令 [“node_modules”在 C 驱动器内],但安装失败并出现以下错误。

OS :Windows 10.

Node JS version: 6.9.0.

Error: EPERM: operation not permitted, unlink.

目标:运行 AngularJs 项目。

命令命令

npm install -- no optional;

PS C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular> npm install --no-optional

npm ERR! path C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular\node_modules\.staging\typescript-5afdc8eb\lib\tsc.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular\node_modules\.staging\typescript-5afdc8eb\lib\tsc.js'
npm ERR!  [Error: EPERM: operation not permitted, unlink 'C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular\node_modules\.staging\typescript-5afdc8eb\lib\tsc.js']
{
npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink ' +
npm ERR!     "'C:\\Users\\arunk\\Work\\Workspaces\\workspace-2\\brainbox-frontend-angular\\node_modules\\.staging\\typescript-5afdc8eb\\lib\\tsc.js'",
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\arunk\\Work\\Workspaces\\workspace-2\\brainbox-frontend-angular\\node_modules\\.staging\\typescript-5afdc8eb\\lib\\tsc.js'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\arunk\AppData\Roaming\npm-cache\_logs\2019-05-22T19_01_22_659Z-debug.log

最佳答案

我遇到了同样的问题,尝试了很多不同的方法。这解决了我的问题:

1 - Uninstall NodeJs
2 - Delete folders 'npm' and 'npm-cache' from AppData/Roaming
3 - Deactivate firewall and all antivirus (including Windows Defender)
4 - Reboot the system
5 - Open command prompt as administrator and execute 'npm install'

关于node.js - npm 安装失败,错误 : EPERM: operation not permitted, 取消链接 '\node_modules',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56263640/

相关文章:

powershell - 有没有办法对任何用户使用 ConvertFrom-SecureString 和 ConvertTo-SecureString?

node.js - req.body 在帖子上为空

javascript - 无法访问 Angular.js 服务中的功能

javascript - Controller 函数在用作插值时被调用两次

javascript - 类型错误: Cannot read property 'setMainPage' of undefined in onsen ui,

registry - ShellIconOverlayIdentifiers 和 windows10

xampp - Windows 10,Xampp,Apache 无法启动,端口 80 正在使用中

javascript - 是否有支持参数转换和 "polymorphism"的 JavaScript 文档生成器?

node.js - 以编程方式在 Sharepoint 中编辑 Excel 文件

node.js - npm 和 node 版本不兼容会产生错误