本文介绍: 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
C:Userslenovo>npm install -g vue
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path F:nodenode_cache_cacacheindex-v54bd5ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'F:nodenode_cache_cacacheindex-v54bd5ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa'
npm ERR! [Error: EPERM: operation not permitted, open 'F:nodenode_cache_cacacheindex-v54bd5ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'F:\node\node_cache\_cacache\index-v5\4b\d5\ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa',
npm ERR! requiredBy: '.'
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.
npm ERR! Log files were not written due to an error writing to the directory: F:nodenode_cache_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
首先需要在安装node.js文件夹中自行创立这两个文件夹,node_global代表全局变量的文件夹,node_cache代表缓存的文件夹。
接下来要配置文件:
npm config set prefix "D:Coding_toolsNodejsnode_global"
npm config set cache "D:Coding_toolsNodejsnode_cache"
这里换成自己的路径即可。
接下来就是配置环境变量:
然后将用户变量中Path,关于node的环境变量改为目前的全局变量地址。
这样就可以了,但是当我们再到cmd窗口去进行npm下载时就会报错
报错的内容说是权限不够,不能新建_cacache,这表示目前的权限不够,所以需要换管理员模式的powershell,与我之前用的管理员模式的cmd不太相同,仅供参考:
在搜索窗口上输入powershell,选择run as Administrator即可
原文地址:https://blog.csdn.net/weixin_55193164/article/details/128887272
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_19349.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。