Proxy settings in npm-yeoman - node.js

I am building my angular application using yeoman.
I have set proxies and registry as follows:
npm config set proxy http://proxy.tcs.com:8080
npm config set https-proxy http://proxy.tcs.com:8080
npm config set registry http://registry.npmjs.org/
Even after setting proxy as above,while installing
npm install grunt-ngmin,
I get the following error,
npm WARN package.json teamshareangular#0.0.0 No README.md file found!
npm http GET http://registry.npmjs.org/grunt-ngmin
npm http 407 http://registry.npmjs.org/grunt-ngmin
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token <
npm ERR! <HEAD><TITLE>Proxy Authorization Required</TITLE></HEAD>
npm ERR! <BODY BGCOLOR="white" FGCOLOR="black"><H1>Proxy Authorization Required</H1><HR>
npm ERR! <FONT FACE="Helvetica,Arial"><B>
npm ERR! Description: Authorization is required for access to this proxy</B></FONT>
npm ERR! <HR>
npm ERR! <!-- default "Proxy Authorization Required" response (407) -->
npm ERR! </BODY>
npm ERR!
npm ERR! at Object.parse (native)
npm ERR! at RegClient.<anonymous> (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:235:23)
npm ERR! at Request.self.callback (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\request\main.js:120:22)
npm ERR! at Request.EventEmitter.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\request\main.js:648:16)
npm ERR! at Request.EventEmitter.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\request\main.js:610:14)
npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:910:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Users\\\Documents\\tools\\nodejs\\nodejs\\\\node.exe" "C:\\Users\\\Documents\\tools\\nodejs\\nodejs\\node_modules\\npm\\bin\\npm-cli.j
"grunt-ngmin"
npm ERR! cwd C:\nodejs\Teamshare\Teamshareangular
npm ERR! node -v v0.10.7
npm ERR! npm -v 1.2.14
npm ERR! type unexpected_token
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\nodejs\Teamshare\Teamshareangular\npm-debug.log
npm ERR! not ok code 0
What is to be done for this?
Should I make some other settings in npm?
Please advice.

Your proxy needs authentication. If you have proxy in your control then create a user and use the folowing command to configure npm to use your credectials. (Note the user & pass before hostname)
$ npm config set proxy http://login:pass#host:port
$ npm config set https-proxy http://login:pass#host:port

For various reasons, the most obvious being security, you might want to avoid putting your proxy credentials in clear text into the npm config.
You can however install a local forwarding proxy that offloads the proxy authentication. Personally, I use squid (in combination with SquidMan, a few colleagues use cntlm. Cntlm has quirks and is unmaintained afaict, but squid works quite well for me.
I run squid on localhost:4321 and configure npm to connect to http://localhost:4321. Squid then authenticates against the corporate proxy with stored, encrypted credentials.

Related

Codeship Basic npm install fails Error: SSL Error: CERT_UNTRUSTED

I'm having a consistent issue where my Codeship Basic setup step is failing when running npm install:
npm http GET https://registry.npmjs.org/babel-runtime
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR! at ClientRequest.<anonymous> (/home/rof/.nvm/v0.6.21/lib/node_modules/npm/node_modules/request/main.js:440:26)
npm ERR! at ClientRequest.g (events.js:156:14)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
npm ERR! at CleartextStream.socketOnData [as ondata] (http.js:1288:20)
npm ERR! at CleartextStream._push (tls.js:375:27)
npm ERR! at SecurePair.cycle (tls.js:734:20)
npm ERR! at EncryptedStream.write (tls.js:130:13)
npm ERR! at Socket.ondata (stream.js:38:26)
npm ERR! [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "node" "/home/rof/.nvm/v0.6.21/bin/npm" "install"
npm ERR! cwd /home/rof/src/
npm ERR! node -v v0.6.21-pre
npm ERR! npm -v 1.1.37
npm ERR! message SSL Error: CERT_UNTRUSTED
npm http GET https://registry.npmjs.org/axios
The same npm install / package.json works without issue on my local system.
I'm trying to avoid just disabling SSL certificate verification as that doesn't seem like the right fix to the underlying problem.
Anybody else seen this when using Codeship?
npm ERR! node -v v0.6.21-pre
npm ERR! npm -v 1.1.37
This appears to be an end of life issue with node versions.
You are running older versions of both node and NPM, and the SSL get's shut off. Essentially the only options are using non-SSL registries, or using a newer version of node/npm.
npm config set strict-ssl false
npm config set registry="http://registry.npmjs.org/"
I don't believe that the npm client included with Node 0.6 contains the necessary certificates to connect to the npm registry over SSL. SSL certificates expire, as you know, and so this is simply a natural consequence of using old software to connect to SSL servers, from what I understand.
I'm linking to the NPM issue - https://github.com/npm/npm/issues/4391

npm-adduser failing on entering npm account's credentials

I had created an npm package using a different machine. I git cloned that package into a different machine and tried running npm publish and got the following error:
npm ERR! need auth auth and email required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "publish"
npm ERR! cwd /home/tarun/me/github/ng-popover
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code ENEEDAUTH
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/tarun/me/github/ng-popover/npm-debug.log
npm ERR! not ok code 0
I figured I would need to run npm-adduser. So, I ran it and entered my credentials of my npm account. Then I got the following error:
npm http PUT https://registry.npmjs.org/-/user/org.couchdb.user:tarun-dugar
npm http 400 https://registry.npmjs.org/-/user/org.couchdb.user:tarun-dugar
npm ERR! Error: ValidationError: child "password" fails because ["password" is required] : -/user/org.couchdb.user:tarun-dugar
npm ERR! at RegClient.<anonymous> (/usr/share/npm/node_modules/npm-registry-client/lib/request.js:272:14)
npm ERR! at Request.self.callback (/usr/lib/nodejs/request/index.js:148:22)
npm ERR! at Request.EventEmitter.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/index.js:896:14)
npm ERR! at Request.EventEmitter.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (/usr/lib/nodejs/request/index.js:847:12)
npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:920:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "adduser"
npm ERR! cwd /home/tarun/me/github/ng-popover
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/tarun/me/github/ng-popover/npm-debug.log
npm ERR! not ok code 0
Any idea how I can solve this issue?
The problem was that I was using an old version of npm (1.3.10). To solve this I upgraded npm using the tips from this link: upgrade npm on ubuntu
And finally adding a symlink as described in this link: symlink

Macbook cannot install hexo

Here is the log:
npm ERR! Error: read ETIMEDOUT
npm ERR! at errnoException (net.js:863:11)
npm ERR! at TCP.onread (net.js:524:19)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Darwin 14.1.0
npm ERR! command "/Users/JianqingJiang/~/nvm/v0.10.0/bin/node" "/Users/JianqingJ
npm ERR! cwd /
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! syscall read
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm http GET https://registry.npmjs.org/abbrev
I install the git and node.js and looks good but when I want to install hexo, the error shows up.
As mentioned in the comments, full command would help. I will assume that you were doing npm install hexo...
What can be deduced here is that npm tried to obtain theabbrev package (the first dependency of hexo, btw) and the HTTP request timed out.
So you should check your network connection etc (proxies ...) and try again. I just installed here without issue.

My npm is not working

my npm is not working at all. Not only when I'm trying to install using a package.json file, but also when I'm just trying to install a node module. Here is what comes up in the terminal:
npm http GET https://registry.npmjs.org/express/3.3.3
npm http GET https://registry.npmjs.org/express-hbs
npm http GET https://registry.npmjs.org/ember
npm http GET https://registry.npmjs.org/mongojs
npm http GET https://registry.npmjs.org/everyauth
npm http GET https://registry.npmjs.org/path
npm http GET https://registry.npmjs.org/charlotte
npm http GET https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/socket.io-client
npm ERR! Error: failed to fetch from registry: mongojs
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/christian/nave/myspendingNode/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /home/christian/nave/myspendingNode
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: mongojs
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/christian/nave/myspendingNode/npm-debug.log
npm not ok
Can anyone point me in the direction to fix this?
npm config set registry http://registry.npmjs.org/
This basically changes the url to http instead of the default https

Error on Installing mobify-client

I got this error while trying to install mobify client. My node.js version is: 0.8.6 and npm: 1.1.48. Also I am behind a proxy and in first row I just set proxy but I dont know is this act as same as setting http_proxy variable?
C:\Users\user>npm config set proxy http://user:pass#proxy:port
C:\Users\user>npm -g install mobify-client
npm http GET https://registry.npmjs.org/mobify-client
npm http GET https://registry.npmjs.org/mobify-client
npm http GET https://registry.npmjs.org/mobify-client
npm http GET https://registry.npmjs.org/-/mobify-client-0.3.8.tgz
npm ERR! fetch failed https://registry.npmjs.org/-/mobify-client-0.3.8.tgz
npm http GET https://registry.npmjs.org/-/mobify-client-0.3.8.tgz
npm ERR! fetch failed https://registry.npmjs.org/-/mobify-client-0.3.8.tgz
npm http GET https://registry.npmjs.org/-/mobify-client-0.3.8.tgz
npm ERR! fetch failed https://registry.npmjs.org/-/mobify-client-0.3.8.tgz
npm ERR! Error: SSL Error: Hostname/IP doesn't match certificate's altnames
npm ERR! at ClientRequest.<anonymous> (C:\Program Files (x86)\nodejs\node_mo
dules\npm\node_modules\request\main.js:440:26)
npm ERR! at ClientRequest.g (events.js:185:14)
npm ERR! at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR! at HTTPParser.parserOnIncomingClient (http.js:1455:7)
npm ERR! at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR! at CleartextStream.socketOnData (http.js:1366:20)
npm ERR! at CleartextStream.CryptoStream._push (tls.js:485:27)
npm ERR! at SecurePair.cycle (tls.js:839:20)
npm ERR! at EncryptedStream.CryptoStream.write (tls.js:220:13)
npm ERR! at Socket.ondata (stream.js:38:26)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "-g" "install" "mobify-client"
npm ERR! cwd C:\Users\user
npm ERR! node -v v0.8.6
npm ERR! npm -v 1.1.48
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\user\npm-debug.log
npm ERR! not ok code 0
It seems like there could have been two potential issues here. One is that the npm server may have had some issues at the time, you might want to try again now and see if you get the same error. The same question was asked in our Support forums (may even have been asked by you :) ) and another user said that trying again later fixed the issue:
https://support.mobify.com/customer/portal/questions/445465-installation-error
Another issue is that you may be behind a proxy and can't connect to the npm server. You can set the proxy location using this command:
npm config set proxy http://url:port
Or if the proxy is authenticated:
npm config set proxy http://user:pass#url:port

Resources