新安装的node使用 npm无法install问题

当我们新安装好node之后,可能会遇到npm install 下载依赖包的时候,显示下面这种报错:

npm WARN registry Unexpected warning for http://registry.npmjs.org/:ot permitted, open 'D:\\Software\\node\\node_cache\\_cacache\\tmp\\d
npm WARN registry Using stale data from http://registry.npmjs.org/ d
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:\Software\node\node_cache\_cacache\tmp\19f512e6
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'D:\Software\no
npm ERR!  [OperationalError: EPERM: operation not permitted, open 'D'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, open 'D:\S
{
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'open',
npm ERR!     path: 'D:\\Software\\node\\node_cache\\_cacache\\tmp\\1
npm ERR!   },
npm ERR!   isOperational: true,
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'D:\\Software\\node\\node_cache\\_cacache\\tmp\\19f
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 e
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please do
npm ERR! permissions of the file and its containing directories, or 
npm ERR! the command again as root/Administrator.

那么这个问题是为什么呢?
npmrc 这个文件是我们没有配置好,导致的不能使用,我们应该再安装完node之后,使用cmd管理员身份打开,然后配置一下变量

npm config set cache "D:\Software\node\node_cache"
npm config set prefix "D:\Software\node\node_global"
npm install -g cnpm --registry=https://registry.npm.taobao.org

然后看一下node环境配置
在这里插入图片描述
解决办法:
在 c盘目录下找到那个默认隐藏的文件如C:\Users{账户}\下的.npmrc文件 把它删除掉 记住 不是node.js安装目录下的那个!

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嘴巴嘟嘟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值