I'm trying to create react-app but I'm having a ENOENT problem, this is what the command prompt shows:
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
events.js:186
throw er; // Unhandled 'error' event
^
Error: spawn C:\Windows\system32\cmd.exe; 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:80:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\Pedro Fernando\AppData\Roaming\npm\node_modules\create-react-app\node_modules\cross-spawn\lib\enoent.js:34:29)
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:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn C:\\Windows\\system32\\cmd.exe;',
path: 'C:\\Windows\\system32\\cmd.exe;',
spawnargs: [
'/d',
'/s',
'/c',
'"npm ^"install^" ^"--save^" ^"--save-exact^" ^"--loglevel^" ^"error^" ^"react^" ^"react-dom^" ^"react-scripts#0.9.x^""'
]
}
Does anyone had this problem and was able to fix it?
Before anyone asks:
These are my system variables path
Windows System Variables Path
Please, try the following inside your terminal:
First remove all node_modules: rm -fr node_modules/
followed by:
npm install npm#latest -g
npm install -g create-react-app
npm init react-app my-app
Try to change react-scripts version to 2.1.8. This worked for me.
I've come across this issue a few times. Usually it's solved by restarting the computer.
Related
After MacBook updated to v12.4 when I try to run yarn command on my react native project I get this error:
error /Users/jaugustinus/Documents/Dev/Service-Bay/node_modules/fsevents: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /Users/jaugustinus/Documents/Dev/Service-Bay/node_modules/fsevents
Output:
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn node-gyp 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: -2,
code: 'ENOENT',
syscall: 'spawn node-gyp',
path: 'node-gyp',
This command was running fine yesterday and the only change would be Mac OS update.
Tried also running
rm -rf node_modules
yarn cache clean
yarn
and still got the same error
The error I got was when using node version 16.15.0
If I change the node version to 17.8.0 then I am able to run yarn with no issues.
I want to run a react native app by those commands:
npm i -g expo-cli
expo init myapp
cd myapp
npm start
but I get the following error and the metro boundler not work:
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell 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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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\nathan-hp\AppData\Roaming\npm-cache\_logs\2020-09-22T14_48_10_269Z-debug.log
I added this to the path:
C:\Windows\System32
but I still get the error above
ok, that was the solution:
the problem was:
Error: spawn powershell ENOENT
so I need to add:
C:\Windows\System32\WindowsPowerShell\v1.0
to the path.
I openned Windows PowerShell as admin and run:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
run npm start again in the cmd and then metro boundler was openned
I did that commands yesterday but somehow it didnt work, guess I have missed something.
The full explanation can be found here:
https://www.youtube.com/watch?reload=9&v=nfX7HtNiCZI
I am implementing react app.
My environment is in intranet with no internet access.
So, I set react project in outside environment with internet access.
After copying project to intranet environment, I executed npm install and start.
But a error has occurred during starting below.
PS D:\workspaces\my-app> npm start
> my-app#0.1.0 start D:\workspaces\my-app
> react-scripts start
i 「wds」: Project is running at http://10.225.168.119/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from D:\workspaces\my-app\public
i 「wds」: 404s will fallback to /
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! my-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#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\KTDS\AppData\Roaming\npm-cache\_logs\2020-07-02T02_03_07_566Z-debug.log
This project is working fine in outside env.
Is the solution to this issue?
I stumbled over this discussion:
https://github.com/nodejs/node/issues/3675
when googling this error:
{ Error: spawn npm 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)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [ 'root', '-g' ] }
but I dont know how to access this npm.cmd. I was on their site https://www.npmjs.com/package/node-cmd
and I installed it with npm install node-cmd
but Im pretty clueless how to run it, Im getting errors like this when typing
npm run node-cmd
npm ERR! path D:\nodeJS\node-v10.16.0-win-x64\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'D:\nodeJS\node-v10.16.0-win-x64\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
Basically, I want to run this node-cmd inside my project so I can (hopefully) execute:
npx webpack-cli init
successfully
if you're running under win32 try for example:
When installing packages
npm.cmd install
or Run npm scripts syncrhonously
npm.cmd run sync -- --init
I need to use react-select: https://github.com/JedWatson/react-select
For that I needed to first install yarn on Ubuntu 14.04. After the installation, and yarn add react-select I can not build my project anymore with webpack since it is giving me the error:
ERROR in ./views/index.js
Module build failed: Error: Couldn't find preset "es2015" relative to directory "/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome"
at /home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-loader/lib/index.js:50:20)
at /home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-loader/lib/fs-cache.js:118:18
at ReadFileContext.callback (/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-loader/lib/fs-cache.js:31:21)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:437:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! brainimmuneconnectome#0.0.0 webpack: webpack
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the brainimmuneconnectome#0.0.0 webpack 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! /home/nikita/.npm/_logs/2018-06-07T04_11_30_458Z-debug.log
I have presents installed in .babelrc file:
{
"presets": ["es2015", "react", "stage-1"]
}
So, the solutions that I found here:
Error: Couldn't find preset "es2015" relative to directory
are not working. What is going wrong here? How could it be fixed?
I found the solution here:
https://github.com/babel/gulp-babel/issues/93
Doing the following:
npm i babel-preset-es2015
npm i babel-preset-stage-2
Solved the issue.