npm + node V0.11.x does not work behind proxy #4569

Closed
migounette opened this Issue Jan 29, 2014 · 20 comments

Projects

None yet
@migounette

@isaacs What do you think on that ?

With a node version 0.11.9 or 0.11.10, I got a regression with npm. I can't install anymore or update my node_modules via npm.

The reason of the problem is :

npm requires request ("request": "~2.30.0")
and request requires "tunnel-agent": "~0.3.0"

BUT the interface change between 0.3.0 and 0.3.1 !!!

V0.3.0
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port)
Vs
V0.3.1
TunnelingAgent.prototype.addRequest = function addRequest(req, options)

Enjoy....

Details

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\_GIT\webrtc\trunk\webrtc-js-engine
npm ERR! node -v v0.11.10
npm ERR! npm -v 1.3.22
npm http GET https://registry.npmjs.org/connect-flash
npm ERR! TypeError: Request path contains unescaped characters.
npm ERR!     at Agent.request (_http_agent.js:286:11)
npm ERR!     at TunnelingAgent.exports.request (http.js:52:22)
npm ERR!     at TunnelingAgent.createSocket (C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:117:25)
npm ERR!     at TunnelingAgent.createSecureSocket [as createSocket] (C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:185:41)
npm ERR!     at TunnelingAgent.addRequest (C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:80:8)
npm ERR!     at new ClientRequest (_http_client.js:125:16)
npm ERR!     at Agent.request (_http_agent.js:301:10)
npm ERR!     at Object.exports.request (https.js:129:22)
npm ERR!     at Request.start (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:583:30)
npm ERR!     at Request.end (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1237:28)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>


@jgiffard

@migounette Thank you !
I have the same problem with node 0.11.11, I will use node 0.10.25 until the problem is solved.

@migounette

If you want to use node 0.11.11, you can do a manual patch.

Force the version of request declared in the package.json of npm under node_dependencies of request module.

"tunnel-agent": "~0.3.0" with "tunnel-agent": "0.3.0"

Handle with care :)

@polidore

Same issue.

@ataraxus

Same Issue. 0.10.26 does also work

@BlackGlory

+1, v0.11.13-pre

@othiym23 othiym23 changed the title from NPM + node V0.11.x does not work behind proxy to npm + node V0.11.x does not work behind proxy Sep 26, 2014
@notepad104

npm config set registry http://registry.npmjs.org/

@Bigous

Setting the registry worked for most packages that i've had installed. But Cordova package is still with the same problem.

node -v v0.11.14-nightly-20140819-pre
npm -v 1.4.21

(with the stable version, no problem at all)

@othiym23 othiym23 added the bug label Oct 16, 2014
@othiym23

@Bigous I believe your issue is due to Cordova's git dependencies. This Stack Overflow thread has some of the details on configuring Git to use HTTP and HTTPS proxies, but if Cordova is using GitHub shortcuts, this won't be sufficient. Also, your issue is unrelated to the original topic of this issue, so please open a new issue if you need further help with this. Thanks!

@Bigous

@othiym23 Thanks for your reply, and sorry for answer back only 21 days after. My git is ok behind the proxy. I don't know what happens in node 0.11.14 or npm 1.4.21 behind proxy, because it crashes when installing packages randomly, than i delete node_module directory, npm install again, it may crash or it may work... not sure why... not only with Cordova, but with a simple npm install xxx it could occurs too...
Long story short, I switched back to node 0.10.33 and npm to version 1.4.28 ... everything is working flawlessly.
Sorry if I posted it in the wrong issue, it seemed to me it was the right place to put because I tought it was a issue between node 0.11.xx and proxy, but I'm not sure now...
Thanks any way and you have made a very good job!

@migounette

@Bigous Can you provide us a stack trace of your crash !

Currently the issue with the binary installation of node 0.11.14 under windows is this: nodejs/node-v0.x-archive#8591
So, a problem may occurs if you have native modules in a dependency. And may lead to a fail for the compilation, and moreover native modules are closely linked to the node version. If the developer does not use NaN it may lead to a compilation failure due to V8 dependency.

My 2 cents

@Bigous

Hi @migounette I installed 0.11.14 again just to generate the log ;)

In this link you can get the test app that I was working on.
Inside the 7z, you will find the application without node_modules directory and the full log which seems a lot with the details of this issue - on the error part.
The log was generated doing npm install on this application - System: Windows 7 x64.
With node 0.10.xx it works fine.

tks.

@migounette

This is a known bug that I have reported, because the version 0.3.1 has disappeared, read the top of the post.
You need to download the version 0.4.1 from https://github.com/mikeal/tunnel-agent
And unzip here :
C:\Program Files\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent

My 2 cents

@p4ko

@migounette i have the same. i have tried to create an cordova project with SAP Kapsel.

i create the procect in the cmd:

cordova -d create C:\Kapsel_Projects\Kapsel_Test\ com.testproject.kapsel_test Kapsel_Test
"{\"plugin_search_path\":\"C:/SAP/MobilePlatform/KapselSDK/plugins/\"}"

here some information for Kapsel (http://scn.sap.com/docs/DOC-49592)
http://help.sap.com/saphelp_smp304sdk/helpdata/en/7c/1c7d0570061014a19bec0d54ebb4ea/content.htm

if i run this i got an TypeError

TypeError: Request path contains unescaped characers.
at new ClientRequest (_http_client.js:73:11)
at TunnelingAgent.exports.request (http.js:49:10)
at TunnelingAgent.createSockete(C:\Users\pkh\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova_lib\node_modules\request\node_modules\tunell-agent\index.js:117:25)

i have tried your solution with the new tunnel-agent, but it diddn't work.

@migounette

Can you provide me the version of tunnel and request of your package.json under C:\Users\pkh\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova_lib\node_modules\request

@smikes

Is this still a problem for you?

@bigous and @p4ko could you open separate issues if you are still having problems with npm? Right now, this issue has three somewhat related problems in it, and it's easier for us to manage when each issue has a single clear topic.

We are trying to clean up older npm issues, so if we don't hear back from you within a week, we will close this issue. (Don't worry -- you can always come back again and open a new issue!)

Thanks!

@p4ko

Okay I have opened a new issue
thx for help.

#7404

@smikes

Is this still a problem for you?

There is a bad interaction between two known bugs — one in node@>0.11 and iojs and the other in npm@<2.8.2. This can cause ECONNRESET and ETIMEDOUT errors. The full writeup is here: #7699 You can fix this problem by updating your npm to the latest (see below).

To update npm, run sudo npm -g install npm@latest.

To update npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

Thanks!

@othiym23

Closing as resolved / abandoned.

@othiym23 othiym23 closed this May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment