npm install 报错情况如下

情况一

报错**:errno:-4048;**
The operation was rejected by your operation system的解决方法

在这里插入图片描述

原因:操作系统不允许
解决方法:

方法一   
用管理员权限打开node,再执行命令npm install
方法二   
先清空缓存   npm cache clean --force
再安装       npm install ?no-bin-links

no-bin-links 解释
The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.
字面意思是设置 npm install 时不要创建符号链接。
查了下说是为了解决 linux 下,npm 在 ntfs 分区上运行 npm install 遇到的创建软连接失败问题引入的。

情况二

如果安装过程中超时,或者某些依赖无法安装的话,可以用cnpm试下

方法如下
先安装cnpm      npm install -g cnpm --registry=https://registry.npm.taobao.org
使用cnpm安装     cnpm install
Logo

前往低代码交流专区

更多推荐