美文网首页
执行sudo npm出错 ERR timeout

执行sudo npm出错 ERR timeout

作者: interboy | 来源:发表于2020-04-19 10:53 被阅读0次

之前玩树莓派时,安装npm经常会遇到ERR。

root@raspberrypi:/home/pi# sudo npm install -g npm
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning undefined: network timeout at: https://registry.npmjs.org/npm
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! Unexpected end of JSON input while parsing near '...s-close","editor","np'

解决办法

  1. 清除代理
npm config set proxy null
npm config set https-proxy null
  1. 重置设置
npm config set registry http://registry.cnpmjs.org/
  1. 如果重置仍不行,可以设置为淘宝源
npm config set registry https://registry.npm.taobao.org

相关文章

网友评论

      本文标题:执行sudo npm出错 ERR timeout

      本文链接:https://www.haomeiwen.com/subject/ojyybhtx.html