I update the Node latest version to 15.0.1 & npm 7.0.3. After i installed node modules and run my project with npm start its showing these type of errors....
cross-env NODE_ENV=development webpack-dev-server --open --config webpack.dev.js
node:events:304
throw er; // Unhandled 'error' event
^
Error: spawn webpack-dev-server ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:269:19)
at onErrorNT (node:internal/child_process:465:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
at onErrorNT (node:internal/child_process:465:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn webpack-dev-server',
path: 'webpack-dev-server',
spawnargs: [ '--open', '--config', 'webpack.dev.js' ]
}
npm ERR! code 1
npm ERR! command failed
npm ERR! command sh -c cross-env NODE_ENV=development webpack-dev-server --open --config webpack.dev.js
npm ERR! A complete log of this run can be found in:
npm ERR! /home/krishnasai/.npm/_logs/2020-10-28T09_44_19_855Z-debug.log
feels to me that you installed cross-env globally, and it might break whenever you switch node versions.
i would advise you to have cross-env in the dependency of your project. you can do that by installing cross-env and specify that you would like to save it in your package.json.
try this
npm install --save-dev cross-env
then try again to run your project.
Related
I'm trying to dockerize a CRA and later on integrate in my docker-compose alongside other containers. It seems like the container fails to run because of Craco? Here's the error output.
docker run -p 7070:3000 je12emy/app
> #beextravel/beex-mobile-pwa#0.0.1 start /app
> cross-env SKIP_PREFLIGHT_CHECK=true craco start
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn craco ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467: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:275:12)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn craco',
path: 'craco',
spawnargs: [ 'start' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #beextravel/beex-mobile-pwa#0.0.1 start: `cross-env SKIP_PREFLIGHT_CHECK=true craco start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #beextravel/beex-mobile-pwa#0.0.1 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! /root/.npm/_logs/2021-08-20T18_52_28_750Z-debug.log
This is my dockerfile.
FROM node:14-alpine
# set working directory
WORKDIR /app
# install app dependencies
COPY package.json .
RUN npm install
RUN npm install cross-env -g
# add app
COPY . ./
# start app
CMD ["npm","run","start"]
I am new to web development using react. So, i did the following -
npm install -g create-react-app
create-react-app my-app
cd my-app
npm start
But, it is throwing a error which are as follows:
E:\Study\React-course\React-app\my-app>npm start
> my-app#0.1.0 start E:\Study\React-course\React-app\my-app
> react-scripts start
i 「wds」: Project is running at http://192.168.1.5/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from E:\Study\React-course\React-app\my-app\public
i 「wds」: 404s will fallback to /
Starting the development server...
events.js:291
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4058,
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\asus\AppData\Roaming\npm-cache\_logs\2020-07-20T07_10_52_845Z-debug.log
E:\Study\React-course\React-app\my-app>
Instead of using this (npm install -g create-react-app create-react-app) try creating react app using ( npx create-react-app my-app)
And for more clarification follow this
https://create-react-app.dev/docs/getting-started/
Please do not write a special character on your local system folder
This question already has answers here:
npm start issues with react-scripts 3.4.0
(5 answers)
Closed 2 years ago.
I am learning react following this tutorial. I got an error about not having a start script which, using my text editor I added to the package.json file. Now I don't really know how to fix what my new error is.
Updated my package-json file, uninstalled and reinstalled create-react-app, made new react-app folder, read through stack overflow. start it manually with "npx react-scripts start".
My npm -v (6.7.0) and node -v (12.16.0)
File directory tree of react-app
node_modules
list of folders that were added upon making folder using create-react-app
public
favicon.ico
index.html
manifest.json
src
index.js
.gitignore
package.json
package-lock.json
README.md
Error:
circulating#CLAPP-T460-22 MINGW64 ~/Desktop/react-app (master)
$ npm start
> react-app#1.1.0 start C:\Users\circulating\Desktop\react-app
> react-scripts start
i 「wds」: Project is running at http://192.168.1.16/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\circulating\Desktop\re act-app\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-app#1.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-app#1.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\circulating\AppData\Roaming\npm-cache\_logs\2020-06-07T01_ 12_36_919Z-debug.log
Add C:\Windows\System32 to the global PATH environment variable.
or
reinstall your npm with a different react script version. Simply go to your folder in command and reinstall like this:
npm install react-scripts#2.1.8
npm start
I'm having this problem whenever I create a new React folder using npx create-react-app test. npm start does not work and throws this error message in the terminal
> test#0.1.0 start C:\Users\franc\Desktop\test
> react-scripts start
i 「wds」: Project is running at http://192.168.56.1/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\franc\Desktop\test\public
i 「wds」: 404s will fallback to /
Starting the development server...
events.js:288
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! test#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test#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\franc\AppData\Roaming\npm-cache\_logs\2020-03-23T00_10_45_653Z-debug.log
Does anybody know how to solve it?
Take a look in your package.json folder test ./test/package.json
You will see something like this:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
If that is there run npm run start add the word run - also make sure you cd into the test folder after you have created the app.
I solved my problem by adding C:\Windows\System32 to the PATH in my environment variables and restarting the system.
I have a trouble with npm, when I'm connected in my net it works nicely, but then I disconnected the computer, it stop working. When I run any command npm related, it fails giving me this error. Does anyone knows what's going on in there?
I have a Mackbook pro with Capitan OS
webpack-dev-server --config ./webpack/webpack.config.js --content-base ./app/ --watch --hot --inline --progress
70% 4/4 build modulesevents.js:141
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! frontend#1.0.0 dev: `webpack-dev-server --config ./webpack/webpack.config.js --content-base ./app/ --watch --hot --inline --progress`
npm ERR! Exit status 1
Thanks in advance.
This is the key to find the solution:
Error: getaddrinfo ENOTFOUND localhost
I went to my /etc/hosts file and I notice that localhost was not there anymore.
Add this line:
localhost 127.0.0.1
Everything is fine now.