question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After upgrading to 7.1.0, zx start powershell as shell instead of Bash

See original GitHub issue

Expected Behavior

run Bash as shell

we share the project between Windows, MacOs and Linux platforms, and we can’t write scripts for Windows and Linux separately (we have a lot of them)!

Actual Behavior

starts powerShell instead

Steps to Reproduce the Problem

  1. write code
import { $ } from 'zx/core';

await $`rm -rf ./dist/client/assets.json`;
  1. run the code
zx script.mjs
  1. get the error
$ yarn zx ./script.mjs
yarn run v1.22.15
$ D:\Projects\raketa\raketa-web-app-boilerplate\node_modules\.bin\zx ./script.mjs
$ rm -rf ./dist/client/assets.json
Remove-Item : A parameter cannot be found that matches parameter name 'rf'.
At line:1 char:4
+ rm -rf ./dist/client/assets.json
+    ~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
 
Error: Remove-Item : A parameter cannot be found that matches parameter name 'rf'.
At line:1 char:4
+ rm -rf ./dist/client/assets.json
+    ~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
 
    at file:///D:/Projects/raketa/raketa-web-app-boilerplate/script.mjs:3:8
    exit code: 1

while with zx@7.0.8 everything works well

$ yarn run v1.22.15
$ D:\Projects\raketa\raketa-web-app-boilerplate\node_modules\.bin\zx ./script.mjs
$ rm -rf ./dist/client/assets.json
Done in 1.11s.

Specifications

  • Version: 7.1.0
  • Platform: Windows 10

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:20

github_iconTop GitHub Comments

2reactions
budarincommented, Oct 6, 2022

Same issue, how to switch to bash forcibly?

in every script write by hand

if ( process.platform === 'win32' ) $.shell = 'bash'
1reaction
antonmedvcommented, Oct 7, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · google/zx - GitHub
Contribute to google/zx development by creating an account on GitHub. ... After upgrading to 7.1.0, zx start powershell as shell instead of Bash....
Read more >
Migrating from Windows PowerShell 5.1 to PowerShell 7
Update from PowerShell 5.1 to PowerShell 7 for your Windows ... A PowerShell profile is a script that executes when PowerShell starts.
Read more >
Install PowerShell on Linux - Microsoft Learn
Learn about the Linux distributions supported by PowerShell.
Read more >
Installing PowerShell on macOS - Microsoft Learn
After the package is installed, run pwsh from a terminal. Before installing, check the list of Supported versions below. Note. PowerShell ...
Read more >
Installing PowerShell on Windows - Microsoft Learn
PowerShell 7.3 is an in-place upgrade that replaces PowerShell 7.0 and lower. ... You can start PowerShell from a new shell by typing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found