-
Notifications
You must be signed in to change notification settings - Fork 12
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] Probably does not work with WSL2 #62
Comments
Issue template does not have a field for a comment, so here it is. I moved from npm v6 to npm v9.5.0. npm v6 uses opener, it works fine. npm v9.5.0 uses this package and it looks like this package runs different command, even though it detects that I'm using WSL. I am not quite sure that it is a bug in the package. Maybe I'm using not supported version of WSL or something. But here what was going on with opener:
WSL detection was wrong in opener because my But now:
The process fails because there is no I've found a way to run Tbh, I do not understand why it works with way, because as debugging shows the command it generates looks like this:
When I start this command manually, it works:
A bit noisy, but it opens the browser. |
Bumping as this means that It looks like npm/cli#6636 is the same issue. |
Here's a more elegant solution for opening URLs from WSL in your favorite browser. It is based on `sensible-browser` which is included in the default distribution for WSL. This avoids issues with the WSL environment, `cmd.exe`. quoting parameters, etc. In WSL, set the default browser using the `BROWSER` variable, for example, ```sh export BROWSER="/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe" or export BROWSER="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" ``` Note: To permanently set the default browser, add the appropriate entry to your shell's RC file, e.g. .bashrc or .zshrc. To launch a URL from the WSL command line: ```sh sensible-browser https://google.com ``` To launch a URL using `promise-spawn`: ```js const promiseSpawn = require('@npmcli/promise-spawn') promiseSpawn.open('https://google.com') ``` Replaces #118 Closes #62 ### Test ``` os: 5.15.153.1-microsoft-standard-WSL2 node: 20.18.0 npm: 10.8.2 ``` ![image](https://github.com/user-attachments/assets/899801c5-6f05-477e-92c7-f2669526fa03) --------- Co-authored-by: Gar <wraithgar@github.com>
Is there an existing issue for this?
Current Behavior
npm repo pkg
fails.Expected Behavior
npm repo pkg
should open a browser page withpkg
repo.Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: