[英]why does npm install fail when run in windows cmd but works fine when run from git bash or vs terminal?
Tried running npm install -g @angular/cli 尝试运行npm install -g @ angular / cli
and got the below error consistently. 并始终出现以下错误。 Tried running it as administrator as well, yet no result.
尝试也以管理员身份运行它,但没有结果。
23286 error path C:\Users\XX\AppData\Roaming\npm\ng
23287 error code EPERM
23288 error errno -4048
23289 error syscall open
23290 error Error: EPERM: operation not permitted, open 'C:\Users\XX\AppData\Roaming\npm\ng'
23290 error { Error: EPERM: operation not permitted, open 'C:\Users\XX\AppData\Roaming\npm\ng'
23290 error cause:
23290 error { Error: EPERM: operation not permitted, open 'C:\Users\XX\AppData\Roaming\npm\ng'
23290 error errno: -4048,
23290 error code: 'EPERM',
23290 error syscall: 'open',
23290 error path: 'C:\\Users\\XX\\AppData\\Roaming\\npm\\ng' },
23290 error stack: 'Error: EPERM: operation not permitted, open \'C:\\Users\\XX\\AppData\\Roaming\\npm\\ng\'',
23290 error errno: -4048,
23290 error code: 'EPERM',
23290 error syscall: 'open',
23290 error path: 'C:\\Users\\XX\\AppData\\Roaming\\npm\\ng' }
23291 error Please try running this command again as root/Administrator.
23292 verbose exit [ -4048, true ]
I'm not 100% sure about Windows, but this could happen if you're using the project folder somewhere else, or in a different tool, or an Anti-virus locking the the installation. 我不确定Windows是否100%可靠,但是如果您在其他地方使用Project文件夹,或者在其他工具中使用该文件夹,或者使用防病毒功能锁定了安装,则可能会发生这种情况。
try running npm cache clean
and then run npm install
尝试运行
npm cache clean
,然后运行npm install
there may be some process locking the installation.
可能有一些过程锁定了安装。
But is this always going to be with trial and error.但这总是会反复试验的。 How can i identify which process is blocking it and see if i can do something about
我如何确定哪个进程阻止了它,看看我是否可以做些什么
Use Process Explorer (simple exe, no setup required): with it, you can type Ctrl + F and search for " Roaming\\npm
" for instance. 使用Process Explorer (简单exe,无需安装):使用它,您可以键入Ctrl + F并搜索“
Roaming\\npm
”。
Any process with an handle still open on that folder will be displayed. 将显示该文件夹上仍带有句柄的所有进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.