rushstack
rushstack copied to clipboard
[rush] Npm `script-shell` Setting Not Respected by `rush`
Summary
Configuring Rush to use Bash as the script shell on Windows via the .npmrc setting (script-shell=bash) does not work with rush. Despite this configuration, rush always defaults to using cmd.exe, whereas npm run correctly respects the script-shell setting.
Reproduction Steps
- On Windows, install Git Bash or ensure Bash is available.
- Add
script-shell=bashto the.npmrcfile in the project root. - Create a script in
package.json:"scripts": { "test-script": "echo $0" } - Run the script using
rushx:rushx test-script - Run the same script using
npm run:npm run test-script
Expected Result
Both rushx test-script and npm run test-script should execute using Bash and output bash.
Actual Result
npm run test-scriptcorrectly uses Bash and outputsbash.rushx test-scriptusescmd.exeand outputs$0, ignoring thescript-shellsetting.
Technical Details
It appears that rushx does not respect the script-shell configuration in .npmrc, always defaulting to the system shell (cmd.exe on Windows). This inconsistency with npm run may cause issues for projects relying on Unix-like shell behavior.
Suggested Solution
Ensure that rushx checks and honors the script-shell setting from .npmrc when executing scripts, aligning its behavior with npm run.
Standard Questions
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
Yes |
rushVersion from rush.json? |
5.141.2 |
useWorkspaces from rush.json? |
|
| Operating system? | Windows 10/11 |
| Would you consider contributing a PR? | No |
Node.js version (node -v)? |
v20.11.0 |