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

Get correct npm prefix on all Windows unix shells #2789

Merged
merged 1 commit into from Mar 4, 2021

Commits on Mar 4, 2021

  1. Get correct npm prefix on all Windows unix shells

    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
    isaacs authored and ruyadorno committed Mar 4, 2021
    Copy the full SHA
    e69be2a View commit details
    Browse the repository at this point in the history