The operation was rejected by your operating system. npm ERR! It‘s possible that the file was alrea
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!n
在win10系统下安装node.js出现了如下的报错。
C:\Users\lenovo>npm install -g vue
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path F:\node\node_cache\_cacache\index-v5\4b\d5\ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'F:\node\node_cache\_cacache\index-v5\4b\d5\ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa'
npm ERR! [Error: EPERM: operation not permitted, open 'F:\node\node_cache\_cacache\index-v5\4b\d5\ac02d8eac51f5c368b18a948d14b7ba882d43e6f4cafddbf9dda740d2afa'] {
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:\node\node_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_tools\Nodejs\node_global"
npm config set cache "D:\Coding_tools\Nodejs\node_cache"
这里换成自己的路径即可。
接下来就是配置环境变量:
然后将用户变量中Path,关于node的环境变量改为目前的全局变量地址。
这样就可以了,但是当我们再到cmd窗口去进行npm下载时就会报错
报错的内容说是权限不够,不能新建_cacache,这表示目前的权限不够,所以需要换管理员模式的powershell,与我之前用的管理员模式的cmd不太相同,仅供参考:
在搜索窗口上输入powershell,选择run as Administrator即可
所有评论(0)