npm 安装非常慢

Cra*_*hax 4 node.js npm

我有以下 package.json 文件:

{
  "name": "trainologic",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "dependencies": {
    "child_process": "^1.0.2",
    "http-server": "^0.9.0",
    "open": "0.0.5"
  },
  "devDependencies": {

  },
  "scripts": {
    "start": "node main.js"
  },
  "author": "",
  "license": "ISC"
}
Run Code Online (Sandbox Code Playgroud)

当我执行“npm install”时,需要非常非常长的时间来下载 3 个依赖项。

我的操作系统是Ubuntu 16,我的节点版本是v4.2.6。

Aki*_*nde 5

我的建议:

  • 通过尝试下面的命令来重新设置注册表

    npm config set registry http://registry.npmjs.org/ --global

这是因为您的连接可能存在 npm https 连接问题。这可能是由于通过代理连接造成的。

  • 您还可以尝试检查连接并直接连接,而不是通过代理连接。

注意:解决代理问题后,我建议您切换回安全注册表

npm config set registry https://registry.npmjs.org/ --global
Run Code Online (Sandbox Code Playgroud)