Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Brackets 1.8 - Installing extensions from Extension Manager not working #12898

Closed
3 tasks done
nerk opened this issue Nov 11, 2016 · 29 comments
Closed
3 tasks done

Brackets 1.8 - Installing extensions from Extension Manager not working #12898

nerk opened this issue Nov 11, 2016 · 29 comments

Comments

@nerk
Copy link

nerk commented Nov 11, 2016

Prerequisites

  • Can you reproduce the problem with Debug -> Reload Without Extensions?
  • Did you perform a cursory search to see if your bug or enhancement is already reported?
  • Did you read the Troubleshooting guide?

For more information on how to write a good bug report read here
For more information on how to contribute read here

Description

Installing any extensions from Extension Manager fails.

Steps to Reproduce

  1. Open Extension Manager
  2. Install any extension.

Expected behavior: Extension gets installed

Actual behavior: Message box with "Installation failed - Unknown internal error" appears.
Debug console shows "WebSocket connection to 'ws://localhost:51378/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED /utils/NodeConnection.js:84"

If I enable "Node Debugger", the regular "Installing extension from https://..." message is posted, but it just hangs until I cancel it manually.

As a side node: "Reload Without Extensions" does not appear to do anything. I therefore removed the extensions directory manually just in case, but it does not help either.

Versions

Windows 7 Enterprise 64-bit, Service Pack 1
Release 1.8 build 1.8.0-17108

@nerk
Copy link
Author

nerk commented Nov 11, 2016

Forgot to mention that I'm behind a proxy. Proxy is properly configured and list of extensions appear in Extension Manager.

@fuecisla
Copy link

Same thing here. No way to install extensions with the extensions manager

@fluxxus
Copy link

fluxxus commented Nov 11, 2016

Working on Win10 64bit, not working on Win7 32bit !!

@nerk
Copy link
Author

nerk commented Nov 11, 2016

I'm on Windows 64-bit and it does not work. I would actually assume that it would be the other way round since the Brackets msi installer installs the 32-bit version on a 64-bit system.

@fluxxus
Copy link

fluxxus commented Nov 11, 2016

Funny, it is the other way around on my end.

Laptop is running Win10, all fine. Desktop is Win7, can't install.

The only difference is that I had 1.8 pre-release installed on desktop.

@nayeem-ahmed
Copy link

Not working also for me win 32bit

@nerk
Copy link
Author

nerk commented Nov 14, 2016

The problem seems to be related to the proxy configuration:

If no proxy is configured in brackets.json, the Extension Manager still lists the available extensions. I assume it uses the system wide configured proxy (or cached entries somewhere?). If I try to install an extension from the list, it posts a Installation failed - Cannot connect to server. message box.

If I add a proxy setting to brackets.json and try to install an extension, the following is posted to the debug console:

ErrorNotification.js:122 [node-error 4:51:19 PM] [Launcher] uncaught exception at top level, exiting. TypeError: Request path contains unescaped characters
    at new ClientRequest (_http_client.js:53:11)
    at TunnelingAgent.exports.request (http.js:31:10)
    at TunnelingAgent.createSocket (C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules\request\node_modules\tunnel-agent\index.js:117:25)
    at TunnelingAgent.createSecureSocket [as createSocket] (C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules\request\node_modules\tunnel-agent\index.js:184:41)
    at TunnelingAgent.addRequest (C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules\request\node_modules\tunnel-agent\index.js:80:8)
    at new ClientRequest (_http_client.js:158:16)
    at Object.exports.request (http.js:31:10)
    at Object.exports.request (https.js:199:15)
    at Request.start (C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules\request\request.js:584:30)
    at Request.end (C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules\request\request.js:1212:28)

I seems the proxy setting is now being sent to the Node backend (in NodeConnection._send()) together with the package URI. The backend does not understand this or the client does not pass these parameters correctly.

@ficristo
Copy link
Collaborator

If you are on a 32 bit platform could you try this workaround?
#12918 (comment)

@nerk
Copy link
Author

nerk commented Nov 17, 2016

@ficristo Sorry, I do not have access to a Windows 32-bit platform. The MSI installer installs the x86 version of Brackets on Windows 64-bit systems. Anyway, I'll give it a try tomorrow.

@nerk
Copy link
Author

nerk commented Nov 18, 2016

@ficristo The workaround does not change anything on my 64-bit Windows, same behavior. However, I am aware that the patched node.exe is the 32-bit version, whereas the originally installed node.exe is a 64-bit version. But as mentioned above, I do not have access to a 32-bit Windows. (Brackets.exe is still 32-bit on my 64-bit Windows, though).

@nerk
Copy link
Author

nerk commented Nov 18, 2016

@ficristo 64-bit node.exe downloaded from /dist/v6.3.1/win-x64/ does not change anything either for me.

@ficristo
Copy link
Collaborator

@nerk sorry if I confused you. There were some comments about 32 bit so I added that workaround for them.
In your case I don't know what's going on...
Were you able to see hte extensions list and install them in 1.7?

@nerk
Copy link
Author

nerk commented Nov 18, 2016

@ficristo Yes, I've been using Brackets since 1.1 and have not had any problems until 1.8.

The problem manifests itsself in https://github.com/nodejs/node/blob/master/lib/_http_client.js:

if (options.path && /[\u0000-\u0020]/.test(options.path)) {
    // The actual regex is more like /[^A-Za-z0-9\-._~!$&'()*+,;=/:@]/
    // with an additional rule for ignoring percentage-escaped characters
    // but that's a) hard to capture in a regular expression that performs
    // well, and b) possibly too restrictive for real-world usage.
    // Restrict the filter to control characters and spaces.
    throw new TypeError('Request path contains unescaped characters');
  } else if (protocol !== expectedProtocol) {
    throw new Error('Protocol "' + protocol + '" not supported. ' +
                    'Expected "' + expectedProtocol + '"');
  }

options.path seems to contain a path with some invalid characters, This only happens if a proxy is configured in Brackets. I already tried to put an URL encoded proxy path into the configuration file, but that does not change anything. I also tried with a 64-bit node v6.0.0 executable without success.

Almost looks to me as if the URL passed to node from Brackets is already broken. Maybe the proxy spec unintentionally becomes part of the request URL (separated by a blank?) which causes the check for options.path to fail. The problem might be not a üroblem with nodejs at all. Just a guess...

@nerk
Copy link
Author

nerk commented Nov 18, 2016

@ficristo Surprisingly, if I replace node.exe with the one included in 1.7 (node v0.10.24), it works!

@ficristo
Copy link
Collaborator

Actually is not so surprising, since we have updated node from 0.10.x to 6.3.x I was expecting some breakage (but I was thinking more about extensions than Brackets itself).
If I'm not mistaken we still don't use any node 6 feature in core, so should be relative safe to use node 0.10. Keep in mind extension authors could start to relying on it.

If you want to mess with Brackets code I wonder if updating the node modules under src\extensibility\node could solve your problem.

@nerk
Copy link
Author

nerk commented Nov 18, 2016

Thanks. I narrowed it down somewhat. The last working version of nodejs is 0.11.3. As of 0.11.4, things go wrong as described above.

The relevant changes might be here:

nodejs/node@49519f1

I can not tell you exactly what is going on, because I'm not really eager to actually debug nodejs. However, if you need more details or I can do something else, please let me know.

@ficristo
Copy link
Collaborator

I don't think it's necessary to debug nodejs itself.

You could try something like:
cd C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules
rm -rf request
cd ..
npm install request@latest
I think this is "safe", but you are still messing with installation's internals ...
Of course you need nodejs (and npm) to run this.

Or better hack on Brackets and update the request library at src\extensibility\node on your source checkout.

I don't guarantee anything but worth a try.

@nerk
Copy link
Author

nerk commented Nov 18, 2016

Not working with request 2.78.1. Now it get ErrorNotification.js:122 [Extensions] Failed to connect to node in the developer console. This is most likely incompatible with other modules of current Brackets.

If I had a version of node.js which actually included options into throw new TypeError('Request path contains unescaped characters'); in _http_client.js, we could actually see more. Maybe @isaacs has some idea what might be going on here?

@ficristo
Copy link
Collaborator

Just to be sure: have you tryed the new request with node 6.3.1?

@nerk
Copy link
Author

nerk commented Nov 18, 2016

I hope so, but something else must have gone wrong.

Anyway, I just updated to Brackets 1.8 on my Windows 10 64-bit system at home. Without proxy configuration, everything is working fine. If I configure a proxy, I am observing exactly the same behavior ("Installation failed - Unknown internal error").

Next I installed request@latest and - voila, the problem is gone! (I get an connection timeout eventually because I am not behind a proxy here at home, but that's expected.)

The problem seems to be indeed related to the version of the used request module. @isaacs Node.js seems not to be involved.

Thanks for your help!

@nerk
Copy link
Author

nerk commented Nov 18, 2016

Actually, if I specify the protocol in the proxy spec, e.g. http://proxy:81 instead of proxy:81, I still get an "internal error". Seems to be a different one, though. This time, nothing is dumped to the Brackets console. I think this just might be such an internal incompatbility you mentioned regarding updating request.

I just leave it at that for now.

@ficristo
Copy link
Collaborator

@nerk could you try to run from source and test #12933 to see if it fixes your problem?

@nerk
Copy link
Author

nerk commented Nov 22, 2016

@ficristo Yes, the error is gone after merging #12933.
👍

@GOPAL140892
Copy link

GOPAL140892 commented Dec 23, 2016

### Here is solution i have found it should work
1 my sys. is 32 bit
2i installed brackets 1.8 new realease
3 prblem is becase node.exe (noe.exe is not compitible wit 32 bit is mistake of devloper)
4 go to this site https://nodejs.org/en/download/
5 download node.js according to your os and bit sys
6 install in brackets folder where node.exe is located
7 finish and restart bracket.....DONE

@nerk
Copy link
Author

nerk commented Dec 23, 2016

@GOPAL140892 Sorry, I don't think that this is the reason. My system is 64-bit. I think you've got a different error, because the problem you describe would be independent from any proxy configuration settings. If you read the comments above, you see that we pretty much figured it out. It is related to incompatible versions of node's request package.

@greencopycat
Copy link

I got the same issue as well.
My machine:

  1. Behind corporate proxy
  2. 64 system
  3. Windows 7
  4. Proxy setting gets "unknown internal error" when trying to install extensions. ("Path contain unescaped character" in developer tools)

I tried reinstalling nodejs, brackets, replace node in extensibility folder, but none of that works.

I fixed my issue by using solution by @ficristo -

I don't think it's necessary to debug nodejs itself.

You could try something like:
cd C:\Program Files (x86)\Brackets\www\extensibility\node\node_modules
rm -rf request
cd ..
npm install request@latest
I think this is "safe", but you are still messing with installation's internals ...
Of course you need nodejs (and npm) to run this.

@zaggino
Copy link
Contributor

zaggino commented Mar 10, 2017

@nerk
Copy link
Author

nerk commented Apr 6, 2017

With Brackets 1.9 the problems regarding proxy configuration are fixed. From my point of view, this issue can be closed.

@ficristo
Copy link
Collaborator

ficristo commented Apr 6, 2017

@nerk glad to know.
Closing

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

No branches or pull requests

8 participants