0
votes

I want to learn node and express js. I installed nodejs perfectly in office and trying to intall expressjs using ' npm install express --g ' , But it is throwing error. I done some proxy setting also using ' npm config set proxy http://autoproxyfh.xxxx.com/VPN-US.pac:80 ' and ' npm config set proxy http://username:password@http://autoproxyfh.xxxx.com/VPN-US.pac:80 ' . But still it is throwing error. Please find the error below.

C:\Users\user\Desktop\Nodejs>npm install express --g npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\Node.js\node.exe" "C:\Program Files\Node.js \node_modules\npm\bin\npm-cli.js" "install" "express" "--g" npm ERR! node v6.4.0 npm ERR! npm v3.10.3 npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=connect ECONNR EFUSED 10.220.81.10:80 npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settin gs. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\RaviKanth.Yandluri\Desktop\Nodejs\npm-debug.log

and tried with another possibility but still throwing error.

C:\Users\user\Desktop\Nodejs>npm config set registry http://regist ry.npmjs.org/

C:\Users\user\Desktop\Nodejs>npm install express npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\Node.js\node.exe" "C:\Program Files\Node.js \node_modules\npm\bin\npm-cli.js" "install" "express" npm ERR! node v6.4.0 npm ERR! npm v3.10.3 npm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED npm ERR! syscall connect

npm ERR! Error: connect ECONNREFUSED 10.1.2.50:80 npm ERR! at Object.exports._errnoException (util.js:1026:11) npm ERR! at exports._exceptionWithHostPort (util.js:1049:20) npm ERR! at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14) npm ERR! { Error: connect ECONNREFUSED 10.1.2.50:80 npm ERR! at Object.exports._errnoException (util.js:1026:11) npm ERR! at exports._exceptionWithHostPort (util.js:1049:20) npm ERR! at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14) npm ERR! code: 'ECONNREFUSED', npm ERR! errno: 'ECONNREFUSED', npm ERR!
syscall: 'connect', npm ERR! address: '10.1.2.50', npm ERR! port: 80 } 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! Please include the following file with any support request: npm ERR! C:\Users\user\Desktop\Nodejs\npm-debug.log

2
You don't need to install express globally, you install it for a specific project (without the -g flag). What you can install globally is the express-generator to help you get started.nem035
even though it is throwing same error.RKCY
Have you tried any of these solutions: question 1, question 2 ?nem035
yes, tried but throwing error again. updated error in questionRKCY

2 Answers

1
votes

The proxy you have configured looks a little odd to me. Are you purposely including the http:// twice? You currently have the following:

npm config set proxy http://username:password@http://autoproxyfh.xxxx.com/VPN-US.pac:80

where I would expect

npm config set proxy http://username:[email protected]/VPN-US.pac:80

I don't know for certain if that would effect anything, but I am behind an ssl inspecting proxy and have mine configured with http://user:pwd@proxyadd:80

Another thing to try would be to open the VPN-US.pac in a browser and check what proxy address it is sending your traffic through and use that directly, instead of using the pac.

The other things to note are if you are behind an ssl-inspecting proxy you will need to get the root certificates your organisation is using and add them to your key store, and tell npm to use the keystore with

npm config set cafile "cafilepath"
0
votes

ECONNREFUSED errors usually happen when you are behind a proxy. It could also be happening due to network firewall misconfiguration at your office. I suggest having a chat with your IT administrator and getting them to check if npm registry is blocked by any chance.

After your network issues are fixed, you don't need to install express globally using -g flag. You need to do the following to setup a project folder inside which you can install express:

mkdir myapp
cd myapp

Initialize NPM project:

npm init

Answer a series of simple questions that will generate your package.json file, then try installing express locally inside the project.

npm install express --save