我是靠谱客的博主 无语含羞草,最近开发中收集的这篇文章主要介绍记录npm 在windows下cmd中报错以及idea下terminal安装依赖时同样报错如题解决,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
如题
报错大致是这样的:
npm WARN locking errno: -4048,npm WARN locking code: 'EPERM',npm WARN locking syscall: 'open',
D:CodeProject2021-3-1ruoyi-vueruoyi-ui>npm install
npm WARN locking Error: EPERM: operation not permitted, open ‘D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock’
npm WARN locking D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock failed [Error: EPERM: operation not permitted, open ‘D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock’] {
npm WARN locking errno: -4048,
npm WARN locking code: ‘EPERM’,
npm WARN locking syscall: ‘open’,
npm WARN locking path: ‘D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock’
npm WARN locking }
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open ‘D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock’
npm ERR! [Error: EPERM: operation not permitted, open ‘D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock’] {
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘open’,
npm ERR! path: 'D:Environmentnodejsnode_cache_locksstaging-9ac46eb88defb0e8.lock’
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.
原因搞明白了其实很简单,就是无论cmd还是terminal下执行时,都不是管理员身份执行的,所以会报错。(新的工作电脑管理员不是我,气抖冷)
解决
两种情况下都以管理员身份打开再次执行。(terminal的话管理员身份打开idea)
最后
以上就是无语含羞草为你收集整理的记录npm 在windows下cmd中报错以及idea下terminal安装依赖时同样报错如题解决的全部内容,希望文章能够帮你解决记录npm 在windows下cmd中报错以及idea下terminal安装依赖时同样报错如题解决所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复