Can not run 'npm start' ReactJS - node.js

I'm new in ReactJS nad Yeoman generator. Soo I have a problem, becasue when I generate project with this command
npm install -g yo
npm install -g generator-react-webpack
yo react-webpack
Then I set up project name, use css, and enable postcss.
When I try to use commend
npm start # or npm run serve
npm run serve
#0.0.1 serve C:\Users\user\Desktop\ProjectReact
node server.js --env=dev
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EACCES 127.0.0.1:8000
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at Server.setupListenHandle [as _listen2] (net.js:1338:19)
at listenInCluster (net.js:1396:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1505:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #0.0.1 serve: `node server.js --env=dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #0.0.1 serve 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\2018-05-25T07_27_23_660Z-debug.log

The port you are using to run the node application in your server.js file is 8000 which is already taken and some other process is running on it.
You can either kill the current running process on 8000 port or change the port in your server.js file to something else than 8000 port. and try running again.

Related

when use vue-cli-service build i got an node error 'Error: write EPIPE'

i got an node error, the cause is to use jenkins to build the projec.
Error: write EPIPE
at process.target._send (internal/child_process.js:841:20)
at process.target.send (internal/child_process.js:712:19)
at callback (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:32:17)
+ npm run build
> widsomfarm_admin_v2#0.1.0 build /home/jenkins/agent/workspace/dvf/F-adopt-backoffice/codeDir
> vue-cli-service build
- Building for production...
WARN A new version of sass-loader is available. Please upgrade for best experience.
Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! widsomfarm_admin_v2#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the widsomfarm_admin_v2#0.1.0 build 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! /softdata/npm_local_repository/_logs/2022-10-28T09_05_45_429Z-debug.log
events.js:377
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at process.target._send (internal/child_process.js:841:20)
at process.target.send (internal/child_process.js:712:19)
at callback (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:400:28)
at emit (internal/child_process.js:912:12)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
Emitted 'error' event on process instance at:
at internal/child_process.js:845:39
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Shell Script -- npm run build (self time 1min 10s)
This could be caused by not running npm install before the npm run build in jenkins.
npm install -g #vue/cli
# OR
yarn global add #vue/cli
Also building with CI/CD tools like Jenkins sometimes requires npm install to be replaced with npm ci to make sure doing a clean install of your dependencies. More here npm ci
npm ci
npm run build
...
I get this error too , but only when run build in server environment.
after search about this problem, i found that it because memory limitation ,but unfortunately i couldn't find the right solution .
Maybe this lead will able to help you

simple react works with npm start but not with nohup npm start &

I tested with a simple app generated by
npx create-react-app myfirstreact
It works fine with
npm start
but if I try to run it in the background with
nohup npm start &
I get
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: EBADF: bad file descriptor, read Emitted 'error' event at:
at lazyFs.read (internal/fs/streams.js:165:12)
at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myfirstreact#0.1.0 start:
react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the myfirstreact#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!
/home/jglickman/.npm/_logs/2020-10-06T04_43_39_480Z-debug.log
Try running it like this:
nohup node scripts/start.js
I think this post will help too.

npm start throwing error when trying to create a react app

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

How to fix cross-env issue when running "npm run dev" for vue-cli

When I run npm run dev, I can not get the local IP properly.
Error: listen EFAULT: bad address in system call argument 0.0.0.0:8081
I do.
1. delete the "cross-env" folder and the "cross-spawn" folder under the node_modules
2. run npm install
3. run npm run dev
4. the error ip changes as follows.
Error: listen EFAULT: bad address in system call argument 10.0.75.1:8081
the ip address is vEthernet for the docker.
PS E:\WorkSpace\my-project> npm run dev
> my-project#1.0.0 dev E:\WorkSpace\my-project
> cross-env NODE_ENV=development webpack-dev-server --open --hot
E:\WorkSpace\my-project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:356
if (err) throw err;
^
Error: listen EFAULT: bad address in system call argument 10.0.75.1:8081
at Server.setupListenHandle [as _listen2] (net.js:1279:14)
at listenInCluster (net.js:1327:12)
at doListen (net.js:1460:7)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project#1.0.0 dev 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\LG\AppData\Roaming\npm-cache\_logs\2019-06-11T13_23_46_070Z-debug.lo
What if you try this:
yarn remove webpack-dev-server
yarn add webpack-dev-server#2.9.1 --dev
yarn run dev
or using npm instead yarn

npm start fail today with following error

when I test my code today at react, I fail to start the dev server, and the error shows as blow.
material#2.0.0 start /Users/linyujie/Files/Softprofiles/SourceCode/successmanagerreact
npm run serve:dev
> material#2.0.0 serve:dev /Users/linyujie/Files/Softprofiles/SourceCode/successmanagerreact
> webpack-dev-server --host 0.0.0.0 --port 3000 --open --env dev
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 0.0.0.0:3000
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at doListen (net.js:1501:7)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! material#2.0.0 serve:dev: `webpack-dev-server --host 0.0.0.0 --port 3000 --open --env dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the material#2.0.0 serve:dev 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! /Users/linyujie/.npm/_logs/2018-06-25T04_55_36_232Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! material#2.0.0 start: `npm run serve:dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the material#2.0.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! /Users/linyujie/.npm/_logs/2018-06-25T04_55_36_255Z-debug.log
The port 3000 is in use. Try to use netstat to find the PID of the process that is using the port. And stop/kill the process if you do not need it. This link might be handy for windows and this for mac to find the process listening on the port.
as the error said: Error: listen EADDRINUSE 0.0.0.0:3000, it means there is an application currently using the same IP & port: 0.0.0.0:3000. If you're not sure which application is using, maybe you can try closing all the command prompt and launch only your application.

Resources