解决 “npm WARN logfile could not be created: Error: EPERM: operation not permitted,...”
创建项目发现node安装到非 “c盘"报错解决
·
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'D:\nodejs\node_cache\_logs\2022-08-09T03_07_24_221Z-debug-0.log'
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open 'D:\nodejs\node_cache\_logs\2022-08-09T03_07_24_798Z-debug-0.log'
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:\nodejs\node_cache\_cacache\tmp\299683ad
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'D:\nodejs\node_cache\_cacache\tmp\299683ad'
npm ERR! [Error: EPERM: operation not permitted, open 'D:\nodejs\node_cache\_cacache\tmp\299683ad'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'D:\\nodejs\\node_cache\\_cacache\\tmp\\299683ad'
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: D:\nodejs\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
解决方法:
- window + r —> cmd --> where node --> 找到nodejs所在路径
- nodejs文件 --> 右击 -->属性
- 安全 —> 选择Users —> 编辑 —> 选中完全控制 —> 点击确认
为什么会报这个问题? 因为没有权限。
更多推荐
已为社区贡献4条内容
所有评论(0)