Open vsawant1608 opened 3 years ago
Same here 😢
Same here. Have tried clearing NPM cache and clearing out node_modules
. Scripty exclaims that it can find the script and tries to execute it. The script is executable and works when run directly with bash.
@vsawant1608 I feel the mistake might be in creating the script file, it should be with extension .cmd
As per documentation : In order to add Windows support, you could define scripts-win/script.cmd
For more details on windows support you can read it here
@sanketphansekar followed those instructions, however what if the script is type #!/usr/bin/env node
?
I was having the same issue regardless of how I configured the shebang. (node, cmd, pwsh, bash, whatever) I also deleted node_modules, any .lock files I had, and re-ran yarn.
I was able to get it to work by running wsl
from the terminal, then running my scripty script. I have both a /scripts folder and a /scripts-win folder. The version that gets called from the wsl prompt is the /scripts version, which I actually prefer so that I don't have to maintain two sets of scripts.
Unfortunately using wsl only gets past the initial events.js // Unhandled 'error'. My initial test script just had a console.log statement in it. When I added something that I actually want the script to do, it failed.
Changing my node scripts to .cmd files resolved all errors, but left me stuck with re-writing my scripts, which at this point isn't worth the trouble. I want to use JavaScript.
Issues like this make me seriously consider switching to a Mac for good.
Just a hack for this would be to update file in node_modules to use cross_spawn(https://www.npmjs.com/package/cross-spawn). It makes most of the things work fine on windows without any issues.
Any news?
I have below package.json file
and below is '/scripts/foo.sh'
When I run
npm run foo
getting below error on windows.Just works fine on ubuntu. Any pointers would be helpful. I tried passing {shell:true} in
node_modules\scripty\lib\run\spawn-script.js:8:17
and it just worked fine.