npm install 异常

npm ERR!  [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_cache\_cacache\index-v5\87\99'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\Program Files\\nodejs\\node_cache\\_cacache\\index-v5\\87\\99',
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! A complete log of this run can be found in:
 

解决方法:1.删除C:\Users\用户\下的.npmrc文件

如果上述方法不管用,就试试2

2.执行 npm chche clean --force

再试npm install 成功

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
npm install和yarn install都是用于安装JavaScript包***和Tilde联合推出的一个新的JS包管理工具,旨在弥补npm的一些缺陷。 npm install命令会下载和安装项目所需的所有包,并将它们保存在项目的node_modules文件夹中。在安装过程中,如果其中一个包出现异常npm会继续安装其他包,导致错误信息可能会在一大堆提示信息中丢失。 相比之下,yarn install命令也会下载和安装项目所需的所有包,但它会先检查项目根目录下是否存在yarn.lock文件。如果存在yarn.lock文件,yarn会根据该文件中记录的具体版本来安装包,以保证环境的一致性。如果不存在yarn.lock文件,yarn会根据项目的package.json文件来安装包。此外,yarn在安装过程中会提供更详细的错误信息,以帮助开发者找到并解决问题。 综上所述,npm install和yarn install都是用于安装JavaScript包的命令,但yarn相对于npm具有更好的错误处理和版本管理功能。如果项目中存在yarn.lock文件,建议使用yarn install来保证项目的稳定性和一致性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [优先级纱线:如果项目具有yarn.lock,请将npm install更改为yarn](https://download.csdn.net/download/weixin_42098251/15016695)[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: 50%"] - *2* *3* [npm与yarn的区别](https://blog.csdn.net/weixin_44368408/article/details/125407880)[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: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值