本文介绍了npm安装失败,并显示错误:EPERM:不允许操作,取消链接' \ node_modules'.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I try to run "npm install" command in CMD ["node_modules" is inside C drive] but installation failing with below error.

OS :Windows 10.

Node JS version: 6.9.0.

目标:运行AngularJs项目.

Goal: To run AngularJs project.

CMD命令

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

推荐答案

如果在另一个正在使用的终端窗口中尝试卸载依赖项,也会发生类似的问题

Similar problem can also happen if you try to uninstall a dependency while in another terminal window you're using

ng serve

只需停止该操作,然后您就可以卸载它.

Simply stop that operation and only then you can uninstall it.

这篇关于npm安装失败,并显示错误:EPERM:不允许操作,取消链接' \ node_modules'.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:08