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.

Doesn't work in PowerShell

See original GitHub issue

Using 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:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
blakeembreycommented, Mar 7, 2022

@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.

0reactions
blakeembreycommented, Mar 7, 2022
Read more comments on GitHub >

github_iconTop 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 >

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