[问题] npm ERR! errno -4048

在 vscode 中使用 npm install 命令时报错:

npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\node\node_cache\_cacache
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\z-node\node\node_cache\_cacache'
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'D:\z-node\node\node_cache\_cacache'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'D:\\node\\node_cache\\_cacache'
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:\node\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

关键字:

...
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted
...

指没有操作权限,使用管理员身份打开当前的编辑器,重新执行 npm install ,成功。

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用、和中提到了npm ERR! errno: -4048的错误信息。该错误通常表示操作被拒绝,即没有足够的权限执行该操作。 在这种情况下,可能有几种解决方法可以尝试: 1. 确保你有足够的权限来执行操作。如果你是在Windows系统上执行npm命令,请确保以管理员身份运行命令提示符或使用管理员权限运行编辑器。 2. 检查文件和文件夹的权限。确保你有读写权限,并且文件和文件夹没有被其他进程锁定。 3. 尝试将npm安装目录更改为另一个位置,例如你的用户文件夹。有时,安装在系统目录中可能会导致权限问题。 4. 清除npm缓存并重新安装依赖项。你可以使用以下命令清除npm缓存: npm cache clean --force 然后,重新运行npm install命令来安装依赖项。 请注意,每个情况都是独特的,因此可能需要根据你自己的环境和具体的错误信息来尝试不同的解决方法。希望这些解决方法能帮助你解决npm ERR! errno: -4048的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [npm 错误 -errno -4048](https://blog.csdn.net/cdd9527/article/details/127980003)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [npm install报错errno -4048](https://blog.csdn.net/Koreyoshi123654/article/details/127841364)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [npm ERR! code EPERM npm ERR! syscall open npm ERR! path C:\Program Files\nodejs\node_cache\_cacache\](https://download.csdn.net/download/weixin_38663701/14040568)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值