Windows 7:使用“npm install”命令解决安装npm dependecies的问题

时间:2020-12-11 22:56:04

I am trying to install npm dependencies mentioned in package.json file using npm install command. One thing I would like to mention that I am in company's network but I tried using admin rights also. Still getting same error. Below is the error screenshot: Windows 7:使用“npm install”命令解决安装npm dependecies的问题

我正在尝试使用npm install命令安装package.json文件中提到的npm依赖项。有一件事我想提到我在公司的网络中,但我也试过使用管理员权限。仍然得到同样的错误。以下是错误截图:

Here is my package.json file:

这是我的package.json文件:

{
  "name": "gulp-autoreload",
  "description": "The simplest Live Reload environment",
  "version": "0.0.1",
  "dependencies": {
    "connect": "^2.14.4",
    "connect-livereload": "^0.5.3",
    "gulp": "^3.8.5",
    "gulp-livereload": "^3.8.0",
    "opn": "^1.0.1"
  },
  "scripts": {
    "start": "gulp"
  }
}

Please let me know what could be the problem.

请让我知道可能是什么问题。

1 个解决方案

#1


0  

For those who are behind a corporate web proxy:

对于那些支持公司Web代理的人:

Setting up Node.js and using npm can be a real pain. I thought that the web proxy settings would be like the rest of the unix world and require to set the HTTP_PROXY and HTTPS_PROXY environment variables. Although I just cloned the Node repository from Github so they are already setup. What gives?

设置Node.js并使用npm可能是一个真正的痛苦。我认为Web代理设置将与unix世界的其余部分类似,并且需要设置HTTP_PROXY和HTTPS_PROXY环境变量。虽然我只是从Github克隆了Node存储库,所以它们已经安装好了。是什么赋予了?

A little searching and I discover that npm uses a configuration file and it can be added to via the command line npm config set .... The key to getting it right is the spelling of the settings. This has bit me so many times now! Getting npm to work behind a proxy requires setting the proxy and https-proxy settings. The key is noticing the - (dash) is not an _ (underscore).

稍微搜索,我发现npm使用配置文件,它可以通过命令行npm config set添加....正确的关键是设置的拼写。现在这让我多了几次!让npm在代理后面工作需要设置代理和https代理设置。关键是要注意 - (破折号)不是_(下划线)。

So the full procedure is install Node.js via the installer or source. Open an command prompt or terminal session and run the following commands to configure npm to work with your web proxy. The commands use proxy.company.com as the address and 8080 as the port

因此,完整的过程是通过安装程序或源安装Node.js.打开命令提示符或终端会话并运行以下命令以配置npm以使用Web代理。这些命令使用proxy.company.com作为地址,使用8080作为端口

npm config set proxy http://proxy.company.com:8080 

npm config set https-proxy http://proxy.company.com:8080

You can check setting with :

你可以检查设置:

npm config ls -l | grep prox

#1


0  

For those who are behind a corporate web proxy:

对于那些支持公司Web代理的人:

Setting up Node.js and using npm can be a real pain. I thought that the web proxy settings would be like the rest of the unix world and require to set the HTTP_PROXY and HTTPS_PROXY environment variables. Although I just cloned the Node repository from Github so they are already setup. What gives?

设置Node.js并使用npm可能是一个真正的痛苦。我认为Web代理设置将与unix世界的其余部分类似,并且需要设置HTTP_PROXY和HTTPS_PROXY环境变量。虽然我只是从Github克隆了Node存储库,所以它们已经安装好了。是什么赋予了?

A little searching and I discover that npm uses a configuration file and it can be added to via the command line npm config set .... The key to getting it right is the spelling of the settings. This has bit me so many times now! Getting npm to work behind a proxy requires setting the proxy and https-proxy settings. The key is noticing the - (dash) is not an _ (underscore).

稍微搜索,我发现npm使用配置文件,它可以通过命令行npm config set添加....正确的关键是设置的拼写。现在这让我多了几次!让npm在代理后面工作需要设置代理和https代理设置。关键是要注意 - (破折号)不是_(下划线)。

So the full procedure is install Node.js via the installer or source. Open an command prompt or terminal session and run the following commands to configure npm to work with your web proxy. The commands use proxy.company.com as the address and 8080 as the port

因此,完整的过程是通过安装程序或源安装Node.js.打开命令提示符或终端会话并运行以下命令以配置npm以使用Web代理。这些命令使用proxy.company.com作为地址,使用8080作为端口

npm config set proxy http://proxy.company.com:8080 

npm config set https-proxy http://proxy.company.com:8080

You can check setting with :

你可以检查设置:

npm config ls -l | grep prox