Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: TypeError: Request path contains unescaped char #321

Closed
perrygovier opened this issue Mar 20, 2015 · 42 comments
Closed

bug: TypeError: Request path contains unescaped char #321

perrygovier opened this issue Mar 20, 2015 · 42 comments

Comments

@perrygovier
Copy link
Contributor

From @Kyozatch on March 19, 2015 8:43

Type: bug

Platform: all

Hi,

I just downloaded ionic. I created the project without any problem but, when i tried "ionic platform add android" i got an error :
"npm http GET https://registry.npmjs.org/cordova-android/3.7.1
TypeError: Request path contains unescaped characters."

I was looking for a solution on google, it seems to be a proxy problem. However, I already set my proxy config and it works..

ionic : 1.3.16 cordova : 4.3.0 node : 0.12.0

Thanks

Copied from original issue: ionic-team/ionic-framework#3355

@jbavari
Copy link

jbavari commented Mar 25, 2015

@kyozatch - does this keep happening every time you run it?

What did you set your proxy settings to?

@jbavari jbavari self-assigned this Mar 25, 2015
@Zatchou
Copy link

Zatchou commented Mar 26, 2015

Yes everytime. I tried on an other free BOX and it works. But with my corporate proxy, it seems pretty complicated.

My .npmrc file :
proxy=http://myproxy:myport/
registry=http://registry.npmjs.org/
https-proxy=http://myproxy:myport/
strict-ssl=false

I did set my environment variables in Windows too.

This config has already been tested and works. Did i miss something else ?...

@r-cohen
Copy link

r-cohen commented Mar 27, 2015

++
same problem on my side. I don't want to downgrade node. seems to be a problem with Cordova rather than ionic because the following command produces also the error :

cordova platform add android

(downgrading node to 0.10.29 does solve the issue, but is lame)

@geisi93
Copy link

geisi93 commented Apr 9, 2015

Did anybody come up with some solution to this problem without downgrading node? it is not a matter of proxy or environment variable - there is some problem with cordova.

@jonmikelm
Copy link

Same problem here, solved the issue downgrading node to 0.10.29

@pulsee
Copy link

pulsee commented Apr 20, 2015

Same problem tried following :
npm config set proxy http://proxydomain:port/
npm config set registry http://registry.npmjs.org/

Tried following versions with error :
Cordova 4.3.0
Cordova 4.0.0

@geisi93
Copy link

geisi93 commented Apr 20, 2015

I didn't want to downgrade node, so I found another solution somewhere in the Web:

Replace the content of C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent

with the content of this zip:

https://github.com/mikeal/tunnel-agent

however, you will probably need to configure the proxy settings as well:

npm config set proxy http://proxy:port
set PROXY=http://proxy:port

@arlyxiao
Copy link

arlyxiao commented May 4, 2015

Same problem here

@Cooker-Monster
Copy link

Hi,
same problem on Windows with :

  • cordova : 5.0
  • npm : 2.7.4
  • node: v0.12.2

@generic-user
Copy link

@geisi93 That works, thanks!

@geisi93
Copy link

geisi93 commented May 13, 2015

for those who still have problems -
propably you have to replace the contents of

C:\Users{USERNAME}\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules\tunnel-agent

with the contents of with the content of this zip:

https://github.com/mikeal/tunnel-agent

too.

@s0th
Copy link

s0th commented May 13, 2015

@geisi93 you are a star! worked perfectly

@faizaghaazfaiz
Copy link

Hi ,
i am facing request path contains unescaped characters even after setting proxy and registry , and even changed the contents of tunnel_agent.

@faizaghaazfaiz
Copy link

I have installed node v0.12.3 , cordova 5.0.0 ,npm 2.9.1
please guide me , what i am doing wrong...

@geisi93
Copy link

geisi93 commented May 18, 2015

look at the console, there you can see the path of the tunnel-agent where the problem occurs. make sure to replace the tunnel-agent exactly in the path, that is shown in the console!

@jason5149
Copy link

Just try the new version of node v0.12.3, but unfortunately they haven't fixed this issue...

@DarrylD
Copy link

DarrylD commented May 19, 2015

Had same issue when trying to run crosswalk, dropped node version back down to 0.10.33, worked fine after that.

@Zatchou
Copy link

Zatchou commented May 20, 2015

I tried @DarrylD's solution. Works perfectly for me. Have a good day.

@vishal2511
Copy link

thanks geisi93, your solution worked like a charm...

@ygayl
Copy link

ygayl commented May 21, 2015

Thanks @geisi93, works perfectly for me too :)

@jbavari
Copy link

jbavari commented May 21, 2015

@geisi93 is this an issue with the cordova-lib then, you think?

I see here they are still using an older version of the request module.

If we can convince them to update it to 2.55.1 - that'd get that fix you all are using - correct?

@geisi93
Copy link

geisi93 commented May 21, 2015

@jbavari basically it works when you downgrade nodejs, so nodejs uses also an old version. but since changing the tunnel-agent in the cordova-lib solves the problem, an update to the newest version could possibly help, yes.

@r-cohen
Copy link

r-cohen commented May 21, 2015

how do you replace tunnel-agent on linux ?
Edit1: on my ubuntu, tunnel-agent to replace is here:
/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent

@ghost
Copy link

ghost commented May 21, 2015

Can someone help me out and explain how to replace the tunnel-agent on windows 8.1. I have installed cordova and nodejs many times, but this latest version is killing me. Here is my output from my command prompt:cordova platform add wp8

npm http GET https://registry.npmjs.org/cordova-wp8/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 (C:\Users\oneilj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\req

uest\node_modules\tunnel-agent\index.js:117:25)

at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\oneilj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modu

les\npm\node_modules\request\node_modules\tunnel-agent\index.js:184:41)

at TunnelingAgent.addRequest (C:\Users\oneilj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\reque

st\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 (C:\Users\oneilj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:

594:30)

at Request.end (C:\Users\oneilj\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:11

86:28)

@geisi93
Copy link

geisi93 commented May 21, 2015

@oneiljm I have explained it above. Just download the current tunnel agent and replace the folder in the path the error message shows

@ghost
Copy link

ghost commented May 21, 2015

Thanks

@paulocesarpcfj
Copy link

Solution from @geisi93 works like a charm :P ! Thank you.

@jonmikelm
Copy link

Also worked @geisi93 's solution for me. It looks like the problem is the npm dependency of the last cordova-lib.

  cordova-lib 5.0.0 -> npm 1.3.4 -> request 2.21.0 -> tunnel-agent: 0.3.0

A newer npm version would resolve to a newer tunnel-agent version.

  cordova-lib 5.0.0 -> ###npm 2.11.0 -> request 2.55.0 -> tunnel-agent 0.4.0###

@nhanh2301
Copy link

This issues still with nodejs version 0.12.4

Need install request module? or request module build-in nodejs?

@samurai55
Copy link

If this issue is not relevant?
request/tunnel-agent#10

@normanhh3
Copy link

Updating the index.js file in the tunnel-agent folder worked for me with Mac OS X Yosemite 10.10.4 - sure seems like there should be a better way! Sigh. :-(

@ngloom
Copy link

ngloom commented Jul 19, 2015

same problem here with newest ionic with error message:

Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================]  100%  0.0s
Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================]  100%  0.0s
Updated the hooks directory to have execute permissions
Update Config.xml
Initializing cordova project


Adding in iOS application by default
npm http GET https://registry.npmjs.org/cordova-ios
An uncaught exception occurred and has been reported to Ionic



Request path contains unescaped characters. (CLI v1.6.1)

Your system information:

Cordova CLI: 5.1.1
Ionic Version: 1.0.1
Ionic CLI Version: 1.6.1
Ionic App Lib Version: 0.3.3
ios-deploy version: Not installed
ios-sim version: 3.1.1
OS: Mac OS X Yosemite
Node Version: v0.12.7
Xcode version: Xcode 6.4 Build version 6E35b

after replace the /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent with newest tunnel-agent v0.41, it seems works,

Thanks all, guys.

@sLatzko
Copy link

sLatzko commented Jul 20, 2015

Thank you very much @geisi93!

@blowsie
Copy link

blowsie commented Jul 23, 2015

@samurai55 still relevant, I ran into this today

@compactdave
Copy link

I have node 0.12.7 and had the problem.
Tried @geisi93's initial solution. Discovered I had installed 64 bit version of node and that there was no tunnel-agent in my install of node. Copied the contents of https://github.com/mikeal/tunnel-agent-master to C:\Program Files\nodejs\node_modules\npm\node_modules, renaming to tunnel-agent.
No good.
Used @geisi93's follow up solution. Found tunnel-agent at C:\Users{USER}\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules. Replaced it with https://github.com/mikeal/tunnel-agent-master, renaming to tunnel-agent.
Perfect!
Many thanks, @geisi93.

@bhandaribhumin
Copy link

when build cordova project in netbeans error :
ant -f C:\Users\EnDev2\Documents\NetBeansProjects\test_application\nbproject "-Dupdate.task.jar=C:\Program Files\NetBeans 8.0\webcommon\ant\extra\org-netbeans-modules-cordova-projectupdate.jar" -Dandroid.project.activity=test_application -Dsite.root=www -Dstart.file=index.html -Dandroid.sdk.home=C:\android\adt-bundle-windows-x86_64-20140702\sdk -Dandroid.target.device.arg=run -Dcordova.version=5.1.1-0.0.0 -Denv.DISPLAY=:0.0 "-Dios.certificate.name=iPhone Developer" -Dandroid.build.target=android-20 -Dconfig=android_1 build-android
check-android-template:
check-cordova-version:
check-cordova-project:
upgrade-to-cordova-project:
create-android:
cordova.cmd -d platform add android
npm http GET https://registry.npmjs.org/cordova-androidNo version supplied. Retrieving version from config.xml...

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 (C:\Users\EnDev2\AppData\Roaming\npm\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
at TunnelingAgent.addRequest (C:\Users\EnDev2\AppData\Roaming\npm\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 (C:\Users\EnDev2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:594:30)
at Request.end (C:\Users\EnDev2\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:1186:28)
C:\Users\EnDev2\Documents\NetBeansProjects\test_application\nbproject\build.xml:150: exec returned: 1
BUILD FAILED (total time: 3 seconds)

@EricOFreitas
Copy link

Hi!
I executed my cmd in administrator mode and executed again the command and work fine ;)

@willywongi
Copy link

See this issue: npm/npm#4569
It's all sorted out with cordova-cli 5.2.0, which is already tagged on github (https://github.com/apache/cordova-lib/releases/tag/5.2.0) but still not on npm.

I wanted to use the new cordova-cli, so this is what I did:

  • Installed dev version of cordova-cli from github:
    sudo npm install -g git://git@github.com:apache/cordova-cli.git
  • Changed a file in ionic-app-lib, which is one of the number of packages under the "ionic" umbrella:
# /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/info.js
# Change line 59 to this:
  info.cordova = result.output.replace('\n', '').slice(0, 5);

This is needed so that ionic recognize cordova version and does not complain about version mismatching.

I tried a lot of things, so beware: this could not work for you; I hope cordova and ionic will update soon though.

Ciao

@ibhag
Copy link

ibhag commented Mar 21, 2016

@geisi93 Thanks for the solution. It worked!!

@RupenAnjaria
Copy link

I tried the solution provided by @geisi93, however, now I am getting below error:
The "RunMdaTargetsInstall" task was not given a value for the required parameter "NpmInstallDir".

@jthoms1
Copy link
Member

jthoms1 commented Oct 28, 2016

Thanks for opening the issue. It seems that issue has been resolved. I am going to close this issue but please feel free to reopen another issue if this occurs again.

@jthoms1 jthoms1 closed this as completed Oct 28, 2016
@PabloEzequiel
Copy link

Thanks a lot +geisi93 !

That works for me, replace:
(x86)\nodejs\node_modules\npm\node_modules\request\node_modules\tunnel-agent

with the content of this zip:

https://github.com/mikeal/tunnel-agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests