Get correct npm prefix on all Windows unix shells#2789
Merged
ruyadorno merged 1 commit intorelease/v7.6.1from Mar 4, 2021
Merged
Get correct npm prefix on all Windows unix shells#2789ruyadorno merged 1 commit intorelease/v7.6.1from
ruyadorno merged 1 commit intorelease/v7.6.1from
Conversation
70f2750 to
5029587
Compare
Contributor
Author
|
Test failure is WSL complaining about no distro being installed. Guess I have to check for that along with statting the WSL bash file. |
5029587 to
284b581
Compare
Contributor
Author
|
One problem with this: running all these bash shells has resulted in an un-deletable folder on my windows machine at |
Contributor
|
Adding "Needs Tests" label to signal it's not ready until the clean up is ready to go 😊 |
Contributor
Author
|
So the locked folder thing, I have no idea why it happened. I can't reproduce it now. |
Contributor
Contributor
Author
|
This is good now. Passes tests without admin privs, npm script shim working in all windows bashes I could find. |
nlf
approved these changes
Mar 4, 2021
1. Set the shebang to /usr/bin/env bash instead of /bin/sh (which might be dash or some other shell) 2. Use Unix-style line endings, not Windows-style (Cygwin accepts either, but mingw bash sometimes objects, and WSL bash always does) 3. Test against paths using wslpath if available, but still pass win32 paths to node.exe, since it is a Windows binary that only knows how to handle Windows paths. This makes npm as installed by the Node.js Windows MSI installer behave properly under WSL, Cygwin, MINGW Git Bash, and the internal MINGW Git Bash when posix CLI utilities are exposed to the cmd.exe shell. The test is not quite as comprehensive as I'd like. It runs on the various Windows bash implementations if they are found in their expected locations, skipping any that are not installed. Short of shipping mingw, cygwin, and wsl as test fixtures, I'm not sure how we could do much better, however. At least, we can use this test to assist debug and catch issues on Windows machines (ours or users who report problems). PR-URL: #2789 Credit: @isaacs Close: #2789 Reviewed-by: @nlf
03eb195 to
e69be2a
Compare
This was referenced Mar 4, 2021
Merged
This was referenced Mar 5, 2021
This was referenced Mar 12, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Get correct npm prefix on all Windows unix shells
be dash or some other shell)
either, but mingw bash sometimes objects, and WSL bash always does)
paths to node.exe, since it is a Windows binary that only knows how
to handle Windows paths.
This makes npm as installed by the Node.js Windows MSI installer behave
properly under WSL, Cygwin, MINGW Git Bash, and the internal MINGW Git
Bash when posix CLI utilities are exposed to the cmd.exe shell.
The test is not quite as comprehensive as I'd like. It runs on the
various Windows bash implementations if they are found in their expected
locations, skipping any that are not installed. Short of shipping
mingw, cygwin, and wsl as test fixtures, I'm not sure how we could do
much better, however. At least, we can use this test to assist debug
and catch issues on Windows machines (ours or users who report
problems).