I installed nodejs and after then when I try to run my previous react app by running yarn start it gives me an error something like this.
Even if I make a new app with create-react-app it gives the same error while trying to start.
nodejs apps are working fine so I think the problem is with create-react-app. I don't know how to fix them.
$ react-scripts start
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
And I have no idea what is wrong. Please help me fix this.
Change react-scripts version in package.json to 2.1.8. It works for me.
I am getting the below error whenever I run nodemon app.js. I have Node.js 7.4.0 and npm 4.1.2 already installed globally and nodemon 6.7.0 as well. If I run my application using command "node" it works fine but if I use command "nodemon" it throws this error.
I tried to uninstall and re-install nodemon but wtih no difference.
The path for npm has been already added to system variables and "C:\Windows\System32" has been added to both user and system variables.
Any kind of help is highly appreciated.
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn C:\Program Files\nodejs\node.exe ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
I have script called sassy.js
var spawn = require('child_process').spawn,
rubySass = spawn('sass', ['--watch scss:.tmp/css', '--sourcemap=auto', '--style=expanded', '--unix-newlines']);
which I try to run with node sassy.js
$ node sassy.js
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn sass ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
It's strange because this code works:
var exec = require('child_process').exec,
rubySass = exec('sass --watch scss:.tmp/css --sourcemap=auto --style=expanded --unix-newlines');
I choose spawn beacuse finally I want to return stdout which I could redirect to node package called clean-css by Npm run script
"scripts": {
"build-sass:clean": "node sassy.js |
}
with: npm run build-sass:clean
EDITED
After help from Lovell Fuller I updated sassy.js rubySass = spawn('c:/Ruby21-x64/bin/sass', ['--watch scss:.tmp/css', '--sourcemap=auto', '--style=expanded', '--unix-newlines'])
but node sassy.js stills yelds
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn c:/Ruby21-x64/bin/sass ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
I've tried with c:/Ruby21-x64/bin/sass.batbut despite no errors, there is no output as well :-/
exec uses the shell to run commands and is able to locate and prefix sass with its full path.
spawn does not run commands via the shell so you'll need to provide the full path, e.g. /usr/bin/sass.
If you're unsure what the full path needs to be, the which sass command should provide this.
I don't know if this will be relevant but did you forget a end quotation?
"scripts": {
"build-sass:clean": (--->)"node sassy.js |
}
"scripts": {
"build-sass:clean": "node sassy.js" |
}
I'm running a command with Node.js using child_process.spawn:
#!/usr/bin/js
var spawn = require("child_process").spawn;
var stockfish = spawn("stockfish");
This works fine using $js spawntest.js from the command line; it just hangs like you would expect because the subcommand is waiting for input.
When I set this script up as a supervisord program, however, it fails:
$ sudo supervisorctl start spawntest
spawntest: ERROR (abnormal termination)
Here is the contents of the stderror output log that supervisor keeps in /var/log/supervisor/spawntest-stderr---supervisor-RyULL0.log:
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
The supervisorctl program is configured like this:
[program:spawntest]
command=/home/gus/dev/spawntest.js
autostart=false
autorestart=false
user=gus
Why is this failing only under Supervisor? Are there any Node.js modules/global variables etc I can use to see what the differences are between invoking a script directly and through Supervisor?
I have installed SpookyJS to execute CasperJs commands in Node.js. I Installed it with this command: npm install spooky, I´m using a Centos machine.
the error:
$ node node_modules/spooky/examples/hello.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
Thanks in advance