npm install 常见报错与解决方案

mpm ERR! Unexpected end of JSON input while parsing near ...
npm ERR! errno -4048
npm ERR! syscall scandir
  • 解决方案
npm cache clean --force

npm install

npm ERR! cb() never called!
npm ERR! This is an error with npm itself.
  • 解决方案
1. 删除npm文件夹下面的node_modules
2. 删除当前项目文件夹的node_modules
3. 删除package-lock.json文件
4. npm cache clean --force
5. npm install
npm ERR! chromedriver@2.46.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! deasync@0.1.21 install: `node ./build.js`
npm ERR! Exit status 1
npm ERR! phantomjs-prebuilt@2.1.13 install: `node install.js`
npm ERR! Exit status 1
  • 解决方案

类似所有的执行 node 命令的报错,基本都可以用这个方法解决#

npm install --ignore-scripts
npm install deasync@0.1.21 --ignore-scripts
Cannot download 'xxxx'
HTTP error 404 Not Found
  • 解决方案

默认下载路径上无法找到对应的资源文件,直接手动修改包的下载地址即可#

sass_binary_site = https://npm.taobao.org/mirrors/node-sass
phantomjs_cdnurl = http://10.25.220.15:8080
原文地址:https://www.cnblogs.com/cwshuo/p/15420916.html