Error: spawn cmd ENOENT in create-react-app - node.js

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.

Related

Error spawning ngrok.exe while running an atlassian connect app

I am trying to create a atlassian connect app for Jira, and this is my first attempt at this. I have configured all the dependencies, including Python 2.7 and windows-production-tools required for it. I have generated an app and trying to run it using npm start, when I am facing the following issue:
Watching atlassian-connect.json for changes
App server running at http://IN-8BRM2J3:3000
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn ./ngrok.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:65:3)
at node:internal/main/run_main_module:17:47
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
I have already npm install ngrok and successfully configured the auth token using ngrok authtoken my-token.
Seems like node is not able to access the ngrok application. Can someone suggest me how to resolve this issue ?

Vue 3 returns an error after running my project and compiling it with npm run dev

Good day. I tried installing the dependencies of a Vue.JS app repository npm install.
Then, I run the Vue.JS app using npm run dev. However, after running it, it shows the following error in the terminal:
PS G:\malaysia-coronavirus> npm run dev
> malaysia-coronavirus#0.0.0 dev
> vite
node:events:504
throw er; // Unhandled 'error' event
^
Error: spawn G:\malaysia-coronavirus\node_modules\esbuild\esbuild.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn G:\\malaysia-coronavirus\\node_modules\\esbuild\\esbuild.exe',
path: 'G:\\malaysia-coronavirus\\node_modules\\esbuild\\esbuild.exe',
spawnargs: [ '--service=0.12.15', '--ping' ]
}
How do I fix this? Did I do something wrong with the dependencies?
Are there any missing installation that I accidentally skipped?
I found a way to fix it. I just had to simply run:
node ./node_modules/esbuild/install.js
Answer from this thread: https://github.com/vitejs/vite/issues/1361#issuecomment-754442599

Issues running a next.js project on server

I am currently trying to run a project (simple test project) of next.js on a Linux server. The project is able to run locally no problem, however every time I run npm run dev or npm run build I get the following error:
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn /nfs/encs/ArchDep/x86_64.EL7/pkg/node-v16.13.0/root/bin/node EAGAIN
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /nfs/encs/ArchDep/x86_64.EL7/pkg/node-v16.13.0/root/bin/node',
path: '/nfs/encs/ArchDep/x86_64.EL7/pkg/node-v16.13.0/root/bin/node',
spawnargs: [
'/nfs/www/groups/h/hn_comp353_2/comp353/node_modules/jest-worker/build/workers/processChild.js'
]
}
Any idea on how to resolve this issue?
I see in your spawnargs that it's trying to execute jest, so this failure has something to do with your Jest tests not being able to run on your Linux server. This may be caused by Jest trying to spawn more threads than there are resources available on your server. This is pretty common on heavily virtualized environments where the resources are limited.
Can you try running Jest with either the --runInBand or --maxWorkers=2? If you're running Jest through npm you'll have to add the command in your package.json like this:
{
"scripts": {
"test": "jest --runInBand"
}
}
As a general remark, NodeJS Error: spawn errors are tricky to debug and can be caused by a variety of issues. There's another SO Q&A with a lot of resources on this topic you can consult.

nodemon app.js throws error spawn C:\Program Files\nodejs\node.exe ENOENT

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

Yeoman - Gulp spawn cmd enoent

With the help gulp yeoman-webapp 'im wolf. But it also serves on the command line, I get the following error gulp. Can you help me? Thank you in advance.
I work in Windows 10 and 64 bit computing.
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn cmd 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)
Try to put in your system variables in the PATH :
C:\Windows\System32;

Resources