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
Open Unable to Connect to localhost on Windows WSL (v. 7.0.0) #154
Comments
// @herberttn |
This is not about really |
The problem is that the url is being enclosed in double quotes to allow spaces and other unmarked characters in the target. As a result, the quotes are getting passed to the browser. // target = `"${target}"`;
// childProcessOptions.windowsVerbatimArguments = true; Commenting lines 76 and 77 of index.js corrects the issue. |
I cannot reproduce the problem. I'm trying Can you guys post some more details about your setup? Versions, envs, shells, etc. |
@herberttn i created very simple repro case. Just clone and run |
@herberttn I can confirm that this bug on Windows 10 + WSL + node v10.15.3 + open 7.0.0 exists. I'm also getting this popup after upgrading to open 7 [edit] added node version |
Can confirm this is happening I just upgraded react-scripts to 3.3.0 (which upgraded open v6 to v7) Reproducible repo here. https://github.com/endiliey/rengorum |
Hey @endiliey, what do you mean by this? Can you give me some more details? |
@herberttn my bad. I tried to reproduce it again, couldn't reproduce it on Windows. Only on WSL for me |
It only happens on WSL, because of some argument handling on Windows that allows arguments to have spaces and other characters. Apparently, it doesn't work for WSL. Lines 76 and 77 of index.js are the culprits. } else if (process.platform === 'win32' || isWsl) {
command = 'cmd' + (isWsl ? '.exe' : '');
cliArguments.push('/s', '/c', 'start', '""', '/b');
// Always quoting target allows for URLs/paths to have spaces and unmarked characters, as `cmd.exe` will
// interpret them as plain text to be forwarded as one unique argument. Enabling `windowsVerbatimArguments`
// disables Node.js's default quotes and escapes handling (https://git.io/fjdem).
// References:
// - Issues #17, #44, #55, #77, #101, #115
// - Pull requests: #74, #98
//
// As a result, all double-quotes are stripped from the `target` and do not get to your desired destination.
target = `"${target}"`;
childProcessOptions.windowsVerbatimArguments = true;
if (options.wait) {
cliArguments.push('/wait');
}
if (options.app) {
if (isWsl && options.app.startsWith('/mnt/')) {
const windowsPath = await wslToWindowsPath(options.app);
// eslint-disable-next-line require-atomic-updates
options.app = windowsPath;
}
cliArguments.push(options.app);
}
if (appArguments.length > 0) {
cliArguments.push(...appArguments);
}
} else { |
Did some more testing. So far it looks like it's only happening when you run via WSL. ✔️ Regular cmd/bash on Windows |
Yeah, I've arrived at the same conclusion. The sad part is I've not been able to find any documentation that even begins to explain why. I guess we could just check if we're in WSL (as some other caveats already do). @sindresorhus would you be comfortable with it? |
If I have to make a guess I will think it is because node thinks it is in Unix, therefore ignore the
|
Which release should we expect to this being fixed so we can update accordingly? I'll test and report the feedback in this thread |
Nice! @XxX-MLGNoob-XxX can this be closed now? |
@karlhorky can confirm Thanks, guys! |
For some reason I cannot open to my localhost port with the current version of the package (7.0.0). Attempting to do so yields the following error:
Windows cannot find '\http://localhost:3000\'. Make sure you typed the name correctly, and then try again.
Here is my JavaScript code:
Note that everything works correctly on version 6.4.0, and I can open to my localhost just fine with that. It's only on 7.0.0 that I'm seeing this issue.
The text was updated successfully, but these errors were encountered: