0

I am using an LXD container to build an angular application. I cannot install any local npm packages inside of my app directories. I've configured my proxy (ip of my container) and registry settings:

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/

My .npmrc shows:

proxy=http://10.57.66.100:8080/
https-proxy=http://10.57.66.100:8080/
registry=https://registry.npmjs.org/

Yet I cannot install any local packages. For example, I tried installing 'Angular Material':

$ cd myapp
$ npm install --save @angular/material

I get the following error:

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

I cannot make any sense out of the log file referenced in the error above.

sudo vim /home/ubuntu/.npm/_logs/2017-06-14T23_40_23_770Z-debug.log

This is what is shows:

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 ]

Any thoughts?

  • Npm doesnt use proxy, its the terminal that uses it (for example git). So set proxy variables for terminal, it should work. – Jaskaranbir Singh Jun 15 '17 at 00:11
  • Hi Jaskaranbir. Thanks for the reply. As far as I know, since I'm using an LXD container, I need to set the proxy settings to the ip address of my container. I am not totally clear on what you mean by "set proxy variables for terminal". Thanks. –  Jun 15 '17 at 00:24

0 Answers0