Doesn't work in PowerShell
See original GitHub issueUsing the onchange 7.1.0 on Windows 10.
This works in cmd:
onchange "**/*" -- echo 1
1
But this doesn’t in PowerShell 7.2.1:
onchange '**/*' -- echo 1
'**\*' is not recognized as an internal or external command,
operable program or batch file.
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn **/* ENOENT
at notFoundError (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn **/*',
path: '**/*',
spawnargs: [ 'echo', '1' ]
}
this doesn’t either:
onchange "**/*" -- echo 1
'**\*' is not recognized as an internal or external command,
operable program or batch file.
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn **/* ENOENT
at notFoundError (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\iborisov\AppData\Roaming\npm\node_modules\onchange\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn **/*',
path: '**/*',
spawnargs: [ 'echo', '1' ]
}
In each sample, after calling onchange
, a file is changed to trigger the echo
. If I’m doing something wrong, then what exactly?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
8 Ways to Fix the “PowerShell Has Stopped Working” Error on ...
1. Enable the Windows PowerShell · 2. Run the Windows PowerShell With Administrative Privileges · 3. Try Using a Different Microsoft Account ·...
Read more >Fix Powershell if It's not Working or Opening in 5 Steps
How do I fix PowerShell has stopped working? · 1. Initiate a full system scan · 2. Initiate a clean boot · 3....
Read more >Fix: PowerShell Has Stopped Working or Not Opening issue in ...
Fix 1 – Disable and Re-enable Windows PowerShell · Fix 2 -Try running Powershell as administrator · Fix 3 – Perform an SFC...
Read more >Powershell broke - basic commands not working, not loading ...
At some point my Powershell broke. Standard commands like 'Write-Host' stopped working. I was using VS Code on Windows 10 and using ...
Read more >How To Fix PowerShell Not Working - TechNewsToday
The main reasons for the PowerShell not working issue include corrupt PowerShell files, misconfigured group policies and service conflicts.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Klaster1 You’re welcome to update the project README using a PR. I’m going to close out this issue since it seems to be resolved, and the resolution appears to be that you can’t use single quotes in PowerShell. I’ve never used PowerShell to confirm how the shell works but if double quotes usually work you can just use them. There’s nothing saying you need to use single or double quotes, it depends on how your shell interprets them. In bash the double quotes may have interpolation while single quotes are just literals arguments.
I’m a little confused too because PowerShell docs mention they work the same way: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.2&viewFallbackFrom=powershell-6.