npm install 报错相关(记录)

302 阅读1分钟
  • npm install 报错 npm WARN tar zlib error: unexpected end of file
- step1.先删除安装失败的依赖
    rm -rf node_modules/

- step2.清除缓存
    npm cache clean --force
    //上面的可能系统不执行 可再执行
    npm cache verify

- step3.解决报错
    way1: 
    npm install --no-package-lock
    
    way2: 
    设置镜像:npm config set registry https://registry.npm.taobao.org
    然后执行npm i
    更建议通过cnpm使用
    设置cnpm:npm install -g cnpm --registry=https://registry.npm.taobao.org
    以后想用国内镜像就用cnpm,国外镜像就用npm
    安装依赖:cnpm i
    一般这样都可以安装上