I tried to follow a reactJs tutorial, but it shows an error while deploying the code on Github pages. I tried to look for solutions but nothing is working. I am new to git and github so kindly help me with this error:
> my-first-app#0.1.0 deploy D:\Full Stack CWH\React Js\my-first-app
> gh-pages -d build
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn git',
path: 'git',
spawnargs: [ 'config', 'user.name' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-first-app#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-first-app#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\agarw\AppData\Roaming\npm-cache\_logs\2022-05-25T15_49_32_003Z-debug.log
PS D:\Full Stack CWH\React Js\my-first-app>
Delete you package node_modules on you AppData/Roaming, re install.
It just somehow didn't give the error the next day after I restarted my pc maybe restarting just fixed my problem.
Related
I installed node JS in my device only last week and its version is 12.18.1 and npm version is 6.14.5 .
npx create-react-app is working and I get all the node modules and other files but when I try to start it gives be following error. PS: I changed the folder and then started as npm start.
npm start
Starting the development server...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projectreact#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projectreact#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-06-28T06_35_26_852Z-debug.log
Please help developers!!
You can try using command :
lsof -i : port number
to get list of all the processes running on the port.
And then kill the process using command kill -9 Process Id
I was trying to learn react. I have installed node 12.16.3 & npm 6.14.4 (LTS)
Then I followed these steps
npm init
npx create-react-app react_project
cd react_project
npm start
First 3 steps worked just fine. But when I entered npm start it's giving me this error.
i 「wds」: Project is running at http://192.168.1.102/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from D:\Node project\react_project\public
i 「wds」: 404s will fallback to /
Starting the development server...
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react_project#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react_project#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lovem\AppData\Roaming\npm-cache\_logs\2020-05-11T06_29_57_551Z-debug.log
I have tried deleting npm modules and reinstall npm then npm start but didn't work.
I have found the solution in a DEV.To blog post
I have added %SystemRoot%\system32 in my environ Path & it solved my prb!
So Anyone facing the same problem i request to try this one!
Happy_Coding
I have created a react app and when I run it shows the following errors. Firstly I thought I made a mistake while creating the app. After that, I have deleted it and created another app and it shows the same errors!
events.js:200
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:81:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fruit_details#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fruit_details#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\abhis\AppData\Roaming\npm-cache\_logs\2020-01-09T06_29_21_939Z-debug.log
Maybe this is a problem with react-scripts. Simply go to your folder in command and reinstall using following command this:
npm install react-scripts#2.1.8
npm start
I created a new react app using CRA. As soon as I started the development server, it throws the error and exits.
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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cart-redux#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cart-redux#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logg
ing output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs\2019-05-26T09_32_50_014Z
-debug.log
The react-scripts version 3.0.1 is avoiding to 'npm start'. I tried downgrading to version 2.1.8, it works fine. But I don't want to downgrade the version everytime to make my app work.
I tried following the similar case, but it didn't help.
Any one else facing the issue, please help to resolve it.
if you tried this and it didn't work for you then this maybe a react-scripts issue so to fix it try this:
remove node_modules and lock files
edit package.json so the version of react-scripts is "2.1.8"
npm install
npm start
LTK how that goes
I tried to deploy my react project on github-pages with npm run deploy and I get the following errors:
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! songs#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the songs#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I've already used npm cache clean, deleted node modules and package-lock.json and ran npm install again. I'm new to React and to programming in general so I can not really figure out what the problem is. Also, I should mention that I am a Windows user. Any help would be much appreciated.
The solution was to set the environment variable $PATH. I followed the steps mentioned here: How do I debug “Error: spawn ENOENT” on node.js?