我正在使用LXD容器来构建角度应用程序。我无法在我的app目录中安装任何本地npm包。我已经配置了我的代理(我的容器的IP)和注册表设置:
npm config set proxy http://10.57.66.100:8080
npm config set https-proxy http://10.57.66.100:8080
npm config set registry https://registry.npmjs.org/
我的.npmrc显示:
proxy=http://10.57.66.100:8080/
https-proxy=http://10.57.66.100:8080/
registry=https://registry.npmjs.org/
但我无法安装任何本地软件包。例如,我尝试安装'Angular Material':
$ cd myapp
$ npm install --save @angular/material
我收到以下错误:
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! fmaterial failed, reason: connect ECONNREFUSED 10.78.35.100:8080
npm ERR! at ClientRequest.req.on.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
npm ERR! at emitOne (events.js:115:13)
npm ERR! at ClientRequest.emit (events.js:210:7)
npm ERR! at emitErr (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:88:11)
npm ERR! at /usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:99:9
npm ERR! at Socket.onerror (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/https-proxy-agent.js:104:5)
npm ERR! at emitOne (events.js:115:13)
npm ERR! at Socket.emit (events.js:210:7)
npm ERR! at emitErrorNT (internal/streams/destroy.js:62:8)
npm ERR! at _combinedTickCallback (internal/process/next_tick.js:102:11)
npm ERR! at process._tickCallback (internal/process/next_tick.js:161:9)
npm ERR! { FetchError: request to https://registry.npmjs.org/@angular%2fmaterial failed, reason: connect ECONNREFUSED 10.57.66.100:8080
npm ERR! at ClientRequest.req.on.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
npm ERR! at emitOne (events.js:115:13)
npm ERR! at ClientRequest.emit (events.js:210:7)
npm ERR! at emitErr (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:88:11)
npm ERR! at /usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:99:9
npm ERR! at Socket.onerror (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/https-proxy-agent.js:104:5)
npm ERR! at emitOne (events.js:115:13)
npm ERR! at Socket.emit (events.js:210:7)
npm ERR! at emitErrorNT (internal/streams/destroy.js:62:8)
npm ERR! at _combinedTickCallback (internal/process/next_tick.js:102:11)
npm ERR! at process._tickCallback (internal/process/next_tick.js:161:9)
npm ERR! message: 'request to https://registry.npmjs.org/@angular%2fmaterial failed, reason: connect ECONNREFUSED 10.57.66.100:8080',
npm ERR! type: 'system',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! code: 'ECONNREFUSED' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2017-06-14T23_40_23_770Z-debug.log
我无法理解上述错误中引用的日志文件。
sudo vim /home/ubuntu/.npm/_logs/2017-06-14T23_40_23_770Z-debug.log
这是显示的内容:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'install',
1 verbose cli '--save',
1 verbose cli '@angular/material' ]
2 info using npm@5.0.3
3 info using node@v8.1.0
4 verbose npm-session 7e3febc55d5e4828
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for @angular/material@2.0.0 request to https://registry.npmjs.org/@angular%2fmaterial failed, reason: connect ECONNREFUSED 10.78.35.100:8080
8 verbose type system
9 verbose stack FetchError: request to https://registry.npmjs.org/@angular%2fmaterial failed, reason: connect ECONNREFUSED 10.57.66.100:8080
9 verbose stack at ClientRequest.req.on.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
9 verbose stack at emitOne (events.js:115:13)
9 verbose stack at ClientRequest.emit (events.js:210:7)
9 verbose stack at emitErr (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:88:11)
9 verbose stack at /usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:99:9
9 verbose stack at Socket.onerror (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/https-proxy-agent.js:104:5)
9 verbose stack at emitOne (events.js:115:13)
9 verbose stack at Socket.emit (events.js:210:7)
9 verbose stack at emitErrorNT (internal/streams/destroy.js:62:8)
9 verbose stack at _combinedTickCallback (internal/process/next_tick.js:102:11)
9 verbose stack at process._tickCallback (internal/process/next_tick.js:161:9)
10 verbose cwd /home/ubuntu/ninjas
11 verbose Linux 4.4.0-79-generic
12 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save" "@angular/material"
13 verbose node v8.1.0
14 verbose npm v5.0.3
15 error code ECONNREFUSED
16 error errno ECONNREFUSED
17 error fmaterial failed, reason: connect ECONNREFUSED 10.78.35.100:8080
17 error at ClientRequest.req.on.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
17 error at emitOne (events.js:115:13)
17 error at ClientRequest.emit (events.js:210:7)
17 error at emitErr (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:88:11)
17 error at /usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:99:9
17 error at Socket.onerror (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/https-proxy-agent.js:104:5)
17 error at emitOne (events.js:115:13)
17 error at Socket.emit (events.js:210:7)
17 error at emitErrorNT (internal/streams/destroy.js:62:8)
17 error at _combinedTickCallback (internal/process/next_tick.js:102:11)
17 error at process._tickCallback (internal/process/next_tick.js:161:9)
17 error { FetchError: request to https://registry.npmjs.org/@angular%2fmaterial failed, reason: connect ECONNREFUSED 10.57.66.100:8080
17 error at ClientRequest.req.on.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
17 error at emitOne (events.js:115:13)
17 error at ClientRequest.emit (events.js:210:7)
17 error at emitErr (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:88:11)
17 error at /usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/agent.js:99:9
17 error at Socket.onerror (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/https-proxy-agent.js:104:5)
17 error at emitOne (events.js:115:13)
17 error at Socket.emit (events.js:210:7)
17 error at emitErrorNT (internal/streams/destroy.js:62:8)
17 error at _combinedTickCallback (internal/process/next_tick.js:102:11)
17 error at process._tickCallback (internal/process/next_tick.js:161:9)
17 error message: 'request to https://registry.npmjs.org/@angular%2fmaterial failed, reason: connect ECONNREFUSED 10.57.66.100:8080',
17 error type: 'system',
17 error errno: 'ECONNREFUSED',
17 error code: 'ECONNREFUSED' }
18 error If you are behind a proxy, please make sure that the
18 error 'proxy' config is set properly. See: 'npm help config'
19 verbose exit [ 1, true ]
有什么想法吗?