0
votes

Am new to nodejs, When I try npm install new packages it shows me the following error: Can anyone help me to resolve this bug. If it would be an earlier response it helps to proceed further.

Nodejs version 11.2.0

npm Version 6.4.1 .npmrc file contains the below information : registry=https://registry.npmjs.org I tried with both https & http, If i add my own proxy also issue exists I did all those following stuffs, but no luck.

proxy=http://:@proxyhost: https-proxy=http://:@proxyhost:

npm config set strict-ssl false npm config set registry "http://registry.npmjs.org/" npm install

    npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443
npm ERR!at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR!at ClientRequest.emit (events.js:182:13)
npm ERR!at TLSSocket.socketErrorListener (_http_client.js:399:9)
npm ERR!at TLSSocket.emit (events.js:182:13)
npm ERR!at emitErrorNT (internal/streams/destroy.js:82:8)
npm ERR!at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
npm ERR!at process.internalTickCallback (internal/process/next_tick.js:72:19)
npm ERR!  { FetchError: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443
npm ERR!at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR!at ClientRequest.emit (events.js:182:13)
npm ERR!at TLSSocket.socketErrorListener (_http_client.js:399:9)
npm ERR!at TLSSocket.emit (events.js:182:13)
npm ERR!at emitErrorNT (internal/streams/destroy.js:82:8)
npm ERR!at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
npm ERR!at process.internalTickCallback (internal/process/next_tick.js:72:19)
npm ERR!message:
npm ERR!'request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443',
npm ERR!type: 'system',
npm ERR!errno: 'ECONNREFUSED',
npm ERR!code: 'ECONNREFUSED',
npm ERR!stack: npm ERR!'FetchError: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443\nat     ClientRequest.req.on.err (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-fetch-npm\\src\\index.js:68:14)\nat ClientRequest.emit (events.js:182:13)\nat TLSSocket.socketErrorListener (_http_client.js:399:9)\nat TLSSocket.emit (events.js:182:13)\nat emitErrorNT (internal/streams/destroy.js:82:8)\nat emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\nat process.internalTickCallback (internal/process/next_tick.js:72:19)' }

complete log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'lodash',
1 verbose cli   '--save' ]
2 info using [email protected]
3 info using [email protected]
4 verbose config Skipping project config: C:\Users\nagarsat/.npmrc. (matches userconfig)
5 verbose npm-session 825293c298355ec4
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 silly fetchPackageMetaData a error for lodash@latest request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 74227ms
11 verbose type system
12 verbose stack Fetcha error: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443
12 verbose stack     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
12 verbose stack     at ClientRequest.emit (events.js:182:13)
12 verbose stack     at TLSSocket.socketa errorListener (_http_client.js:399:9)
12 verbose stack     at TLSSocket.emit (events.js:182:13)
12 verbose stack     at emita errorNT (internal/streams/destroy.js:82:8)
12 verbose stack     at emita errorAndCloseNT (internal/streams/destroy.js:50:3)
12 verbose stack     at process.internalTickCallback (internal/process/next_tick.js:72:19)
13 verbose cwd C:\Users\nagarsat
14 verbose Windows_NT 10.0.16299
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "lodash" "--save"
16 verbose node v11.2.0
17 verbose npm  v6.4.1
18 error code ECONNREFUSED
19 error errno ECONNREFUSED
20 error Fetcha error: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443
20 error     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
20 error     at ClientRequest.emit (events.js:182:13)
20 error     at TLSSocket.socketa errorListener (_http_client.js:399:9)
20 error     at TLSSocket.emit (events.js:182:13)
20 error     at emita errorNT (internal/streams/destroy.js:82:8)
20 error     at emita errorAndCloseNT (internal/streams/destroy.js:50:3)
20 error     at process.internalTickCallback (internal/process/next_tick.js:72:19)
20 error  { Fetcha error: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443
20 error     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
20 error     at ClientRequest.emit (events.js:182:13)
20 error     at TLSSocket.socketa errorListener (_http_client.js:399:9)
20 error     at TLSSocket.emit (events.js:182:13)
20 error     at emita errorNT (internal/streams/destroy.js:82:8)
20 error     at emita errorAndCloseNT (internal/streams/destroy.js:50:3)
20 error     at process.internalTickCallback (internal/process/next_tick.js:72:19)
20 error   message:
20 error    'request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443',
20 error   type: 'system',
20 error   errno: 'ECONNREFUSED',
20 error   code: 'ECONNREFUSED',
20 error   stack:
20 error    'Fetcha error: request to https://registry.npmjs.org/lodash failed, reason: connect ECONNREFUSED 104.16.22.35:443\n    at ClientRequest.req.on.err     (C\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-fetch-npm\\src\\index.js:68:14)\n    at ClientRequest.emit (events.js:182:13)\n    at     TLocket.socketa errorListener (_http_client.js:399:9)\n    at TLSSocket.emit (events.js:182:13)\n    at emita errorNT (internal/streams/destroy.js:82:8)\n        atmita errorAndCloseNT (internal/streams/destroy.js:50:3)\n    at process.internalTickCallback (internal/process/next_tick.js:72:19)' }
21 error If you are behind a proxy, please make sure that the
21 error 'proxy' config is set properly.  See: 'npm help config'
22 verbose exit [ 1, true ]
1

1 Answers

0
votes

You need to configure the web proxy in your npm.

More Info: https://jjasonclark.com/how-to-setup-node-behind-web-proxy/

If that won't work, try with null, like below commands:

npm config set proxy null
npm config set https-proxy null 
npm config set registry http://registry.npmjs.org/