Search code examples
node.jscordovaextjsnpmsencha-cmd

npm http GET error, when running cordova from cmd


When I run cordova platform add iOS on my Mac, and I get this error:

npm http GET https://registry.npmjs.org/cordova-ios/3.8.0
TypeError: Request path contains unescaped characters.
    at new ClientRequest (_http_client.js:73:11)
    at TunnelingAgent.exports.request (http.js:49:10)
    at TunnelingAgent.createSocket (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:117:25)
    at TunnelingAgent.createSecureSocket [as createSocket] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:184:41)
    at TunnelingAgent.addRequest (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:80:8)
    at new ClientRequest (_http_client.js:154:16)
    at Object.exports.request (http.js:49:10)
    at Object.exports.request (https.js:136:15)
    at Request.start (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:594:30)
    at Request.end (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:1186:28)

I have tried to set my proxy by trying all of the following, but nothing seems to be working:

    npm config set registry http://registry.npmjs.org/
npm config set proxy http://myusername:[email protected]:8080
npm config set https-proxy http://myusername:[email protected]:8080
npm config set strict-ssl false
set HTTPS_PROXY=http://myusername:[email protected]:8080
set HTTP_PROXY=http://myusername:[email protected]:8080
export HTTPS_PROXY=http://myusername:[email protected]:8080
export HTTP_PROXY=http://myusername:[email protected]:8080
export http_proxy=http://myusername:[email protected]:8080

npm --proxy http://myusername:[email protected]:8080 \
--without-ssl --insecure -g install

I'm running: nom version 2.5.1, Sencha touch 2.4.1, Sencha cmd 5.1.2.52.

Any ideas what might be causing this?

Please help. Thank you.


Solution

  • Fixed.

    I had to downgrade node.js to 10.25 in order for it to work. Never set a proxy once I got the new version installed. (I had 12.0, but also heard that 11.x doesn't work as well.)

    Here are instructions how: http://www.websector.de/blog/2011/12/15/quick-tip-node-how-to-downgrade-node-js-on-os-x/