1. 程式人生 > 其它 >npm install 常見報錯與解決方案

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! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! [email protected] install: `node ./build.js`
npm ERR! Exit status 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
  • 解決方案

類似所有的執行 node 命令的報錯,基本都可以用這個方法解決#

npm install --ignore-scripts
npm install [email protected] --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