NixOs: Can’t setup development with electron: Error: spawn ENOENT - node.js

I need to create a project involving electron and some libraries (easymidi), but I can't find how to do:
If I install electron from Nix directly, for instance using nix-shell -p electron_17, I can start a basic hello world project, but then I can't import other node libraries (if I install them with yarn, I get an error about unknown symbols, I guess because yarn and the nix electron runs different nodejs version
If I do everything using yarn or npm, electron can't even start a basic hello world folder:
$ nix-shell -p yarn
$ git clone https://github.com/electron/electron-quick-start
$ cd electron-quick-start/
$ yarn install
$ yarn start
yarn run v1.22.15
$ electron .
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn /tmp/c/electron-quick-start/node_modules/electron/dist/electron 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: -2,
code: 'ENOENT',
syscall: 'spawn /tmp/c/electron-quick-start/node_modules/electron/dist/electron',
path: '/tmp/c/electron-quick-start/node_modules/electron/dist/electron',
spawnargs: [ '.' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Any idea what I did wrong? How can I setup electron with some random libraries like easymidi?
EDIT
Here is the log file (tried the same with npm, same error):
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/node',
1 verbose cli '/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.15
3 info using node#v14.18.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle electron-quick-start#1.0.0~prestart: electron-quick-start#1.0.0
6 info lifecycle electron-quick-start#1.0.0~start: electron-quick-start#1.0.0
7 verbose lifecycle electron-quick-start#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle electron-quick-start#1.0.0~start: PATH: /nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/d/electron-quick-start/no
de_modules/.bin:/nix/store/yx24h6ywbkg7rm5x7lrm8mx8ypcf4ywi-bash-interactive-5.1-p8/bin:/nix/store/fj3ywsx22xvjd4mly4323ikjcavyv91v-patchelf-0.13/bin:/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3
.0/bin:/nix/store/a2w3l1m75908yd05a0h40vnrzvxfd0gd-gcc-10.3.0/bin:/nix/store/mfz26azl9561jgd5n73nkszzp6qhsaal-glibc-2.33-50-bin/bin:/nix/store/xyn0240zrpprnspg3n0fi8c8aw5bq0mr-coreutils-8.32/bin:/nix/store/5d5j
1z9bg01wqxahihy2x5n22ykc32w8-binutils-wrapper-2.35.1/bin:/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin:/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin:/nix/store/xyn0240zrpprnsp
g3n0fi8c8aw5bq0mr-coreutils-8.32/bin:/nix/store/1nq62klcc9n2jv2ixaf77makkzdcghrh-findutils-4.8.0/bin:/nix/store/xwkxkx4bk005q35hsdhqbkbdv7g28cz5-diffutils-3.8/bin:/nix/store/dy4ylp9439la4lq35ah2mj80fi87pk4w-gnu
sed-4.8/bin:/nix/store/xxgddhdi57bbgd1yxza44plq6krjmiz1-gnugrep-3.6/bin:/nix/store/31pkw5yi08fj4l0glzvpf1cp4ywkxh86-gawk-5.1.0/bin:/nix/store/nwg8in201f7y6vdm787v3j84jjrn0ayw-gnutar-1.34/bin:/nix/store/ygzg6wzh
gxf51ianb4zjvrzq4ilx9jd7-gzip-1.10/bin:/nix/store/gakfgapj20lv13vkcz6c38j8i9vz4ypi-bzip2-1.0.6.0.2-bin/bin:/nix/store/xgp0bgw4rpnbc3vr2qdsdbixp3zy4v1l-gnumake-4.3/bin:/nix/store/wadmyilr414n7bimxysbny876i2vlm5r
-bash-5.1-p8/bin:/nix/store/347zp4r9a7gm5gk0gwijqw294nnyypcs-patch-2.7.6/bin:/nix/store/f2x98vk07px8916b9xid7jq6ky86sfmi-xz-5.2.5-bin/bin
9 verbose lifecycle electron-quick-start#1.0.0~start: CWD: /tmp/d/electron-quick-start
10 silly lifecycle electron-quick-start#1.0.0~start: Args: [ '-c', 'electron .' ]
11 silly lifecycle electron-quick-start#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle electron-quick-start#1.0.0~start: Failed to exec start script
13 verbose stack Error: electron-quick-start#1.0.0 start: `electron .`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess.<anonymous> (/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1058:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
14 verbose pkgid electron-quick-start#1.0.0
15 verbose cwd /tmp/d/electron-quick-start
16 verbose Linux 5.10.75
17 verbose argv "/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/node" "/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/npm" "start"
18 verbose node v14.18.0
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error electron-quick-start#1.0.0 start: `electron .`
22 error Exit status 1
23 error Failed at the electron-quick-start#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
EDIT
I also tried npm2nix-like tools, but they also failed.

Related

Error: spawn cmd ENOENT while starting React APP

I am creating a React Application. I ran the following command in cmd:
npx create-react-app .
Thereafter I tried to start the server using npm start as instructed in the tutorial:
https://github.com/facebook/create-react-app.
However, I keep getting the following error:
Error: spawn cmd ENOENT.
The log report generated by the error is:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.10.2
3 info using node#v12.9.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle react_todo#0.1.0~prestart: react_todo#0.1.0
6 info lifecycle react_todo#0.1.0~start: react_todo#0.1.0
7 verbose lifecycle react_todo#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle react_todo#0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\Projects\react_todo\node_modules\.bin;C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;E:\Projects\shopping-cart\node_modules\express-generator\bin;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Users\Arun\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\Arun\AppData\Local\Programs\Python\Python37-32\;C:\Users\Arun\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\EasyPHP-Devserver-17\eds-binaries\dbserver\mysql5717x86x191225091928\bin;
9 verbose lifecycle react_todo#0.1.0~start: CWD: E:\Projects\react_todo
10 silly lifecycle react_todo#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle react_todo#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle react_todo#0.1.0~start: Failed to exec start script
13 verbose stack Error: react_todo#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:326:16)
13 verbose stack at EventEmitter.emit (events.js:209:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:209:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid react_todo#0.1.0
15 verbose cwd E:\Projects\react_todo
16 verbose Windows_NT 6.1.7600
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.9.1
19 verbose npm v6.10.2
20 error code ELIFECYCLE
21 error errno 1
22 error react_todo#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the react_todo#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
It would be really helpful if could suggest me a way to resolve this issue. Thank You.
I resolved the issue by following these steps if anyone needs it in future:
Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.
This comment really helped me out: https://github.com/facebook/create-react-app/issues/6908#issuecomment-495064048.
You should install create-react-app globally with -g.
npm install -g create-react-app
Alternatively, you could skip the installation of create-react-app.
For that you need firstly to update to a newer version of nodejs and npm and then you can run.
npx create-react-app yourappname

npm run dev command gives error log and it doesn't open my project in browser

When i run my react node project in my ubuntu system with command npm run dev, It gives me error log and it doesn't opening in my browser, even when i try to open it with localhost:3000 it doesn't working, here is my error log, can anyone please look in it and give me proper solution ?
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'client' ]
2 info using npm#3.5.2
3 info using node#v8.10.0
4 verbose run-script [ 'preclient', 'client', 'postclient' ]
5 info lifecycle mern-auth#1.0.0~preclient: mern-auth#1.0.0
6 silly lifecycle mern-auth#1.0.0~preclient: no script for preclient, continuing
7 info lifecycle mern-auth#1.0.0~client: mern-auth#1.0.0
8 verbose lifecycle mern-auth#1.0.0~client: unsafe-perm in lifecycle true
9 verbose lifecycle mern-auth#1.0.0~client: PATH: /usr/share/npm/bin/node-gyp-bin:/var/www/mern-plaid/node_modules/.bin:/usr/share/npm/bin/node-gyp-bin:/var/www/mern-plaid/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle mern-auth#1.0.0~client: CWD: /var/www/mern-plaid
11 silly lifecycle mern-auth#1.0.0~client: Args: [ '-c', 'npm start --prefix client' ]
12 silly lifecycle mern-auth#1.0.0~client: Returned: code: 1 signal: null
13 info lifecycle mern-auth#1.0.0~client: Failed to exec client script
14 verbose stack Error: mern-auth#1.0.0 client: `npm start --prefix client`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack at emitTwo (events.js:126:13)
14 verbose stack at EventEmitter.emit (events.js:214:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:126:13)
14 verbose stack at ChildProcess.emit (events.js:214:7)
14 verbose stack at maybeClose (internal/child_process.js:925:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid mern-auth#1.0.0
16 verbose cwd /var/www/mern-plaid
17 error Linux 5.0.0-25-generic
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "client"
19 error node v8.10.0
20 error npm v3.5.2
21 error code ELIFECYCLE
22 error mern-auth#1.0.0 client: `npm start --prefix client`
22 error Exit status 1
23 error Failed at the mern-auth#1.0.0 client script 'npm start --prefix client'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the mern-auth package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm start --prefix client
23 error You can get information on how to open an issue for this project with:
23 error npm bugs mern-auth
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls mern-auth
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Unable to run npm start in create-react-app

PROBLEM
Need to run my react project
I have install create-react-app and create a project, When I tried to run project using npm start its showing some error
When I first tried in my home dir everythings work fine, Problem only when I tried to create and run in specfic dir
USING
Kubuntu OS,
Nodejs : V10.15.3
npm : 6.9.0
By little bit of google I done following thing
Remove nodemodule and install
Clear npm cache and one again try it as fresh
Uninstall and install both node and npm
Access the project as root
When I try to : npm ls react
kasi#kasi:~/my/node_modules$ npm ls react
my#0.1.0 /home/kasi/my
`-- react#16.8.6
No other things
Some Google - Check point:
kasi#kasi:~/my/node_modules$ which node
/home/kasi/.nvm/versions/node/v10.15.3/bin/node
kasi#kasi:~/my/node_modules$ which npm
/usr/bin/npm
kasi#kasi:~/my/node_modules$ cd ../../../../usr/local/bin/
kasi#kasi:/usr/local/bin$ ls
create-react-app n node npx tsc tsserver
TIP:
All my disk are FAT type so some problem may be on symlink
When I try to start direct as follow
kasi#kasi:/media/kasi/others/reaact/myapp$ node node_modules/react-scripts/scripts/start.js
It show
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn /media/kasi/others/reaact/myapp/node_modules/opn/xdg-open EACCES
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)
I will attach log file created
0 info it worked if it ends with ok
1 verbose cli [ '/home/kasi/.nvm/versions/node/v10.15.3/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'start' ]
2 info using npm#6.9.0
3 info using node#v10.15.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle myapp#0.1.0~prestart: myapp#0.1.0
6 info lifecycle myapp#0.1.0~start: myapp#0.1.0
7 verbose lifecycle myapp#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle myapp#0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/media/kasi/others/reaact/myapp/node_modules/.bin:/home/kasi/.nvm/versions/node/v10.15.3/bin:/home/kasi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle myapp#0.1.0~start: CWD: /media/kasi/others/reaact/myapp
10 silly lifecycle myapp#0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 info lifecycle myapp#0.1.0~start: Failed to exec start script
12 verbose stack Error: myapp#0.1.0 start: `react-scripts start`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:189:13)
12 verbose stack at maybeClose (internal/child_process.js:970:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
13 verbose pkgid myapp#0.1.0
14 verbose cwd /media/kasi/others/reaact/myapp
15 verbose Linux 4.18.0-18-generic
16 verbose argv "/home/kasi/.nvm/versions/node/v10.15.3/bin/node" "/usr/bin/npm" "start"
17 verbose node v10.15.3
18 verbose npm v6.9.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error myapp#0.1.0 start: `react-scripts start`
23 error spawn ENOENT
24 error Failed at the myapp#0.1.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Build nodejs Fail with exit status 126 - Permission denied

I faced a issue when I do a npm start in my linux server.
It is showing error with exit code 126 and permission denied.
I have already done chmod 777 to server.js or rather to the whole folder of demoTest.
How do I fixed this?
The log is shown as below.
info it worked if it ends with ok
1 verbose cli [ '/opt/node-v8.11.3-linux-x64/bin/node', '/bin/npm', 'start' ]
2 info using npm#5.6.0
3 info using node#v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle demoTest#1.0.0~prestart: demoTest#1.0.0
6 info lifecycle demoTest#1.0.0~start: demoTest#1.0.0
7 verbose lifecycle demoTest#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle demoTest#1.0.0~start: PATH: /opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/useradmin/demoTest/node_modules/.bin:/sbin:/bin:/usr/sbin:/usr/bin
9 verbose lifecycle demoTest#1.0.0~start: CWD: /home/useradmin/demoTest
10 silly lifecycle demoTest#1.0.0~start: Args: [ '-c', 'nodemon ./rest/server.js' ]
11 silly lifecycle demoTest#1.0.0~start: Returned: code: 126 signal: null
12 info lifecycle demoTest#1.0.0~start: Failed to exec start script
13 verbose stack Error: demoTest#1.0.0 start: `nodemon ./rest/server.js`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid demoTest#1.0.0
15 verbose cwd /home/useradmin/demoTest/rest
16 verbose Linux 3.10.0-862.el7.x86_64
17 verbose argv "/opt/node-v8.11.3-linux-x64/bin/node" "/bin/npm" "start"
18 verbose node v8.11.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 126
22 error demoTest#1.0.0 start: `nodemon ./rest/server.js`
22 error Exit status 126
23 error Failed at the demoTest#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
I was getting this same issue when running a Nodejs server and Reactjs client. This process worked for me and should be done in the affected directory (I think that's demoTest for you):
Delete node_modules
Run npm install to reinstall the dependencies in that directory's package.json
I believe this problem started when I copied node_modules from my host to my Ubuntu server rather than running the installs directly from the server CLI.
I am using nodemon and intellij was complaining with "app/server.js: Permission denied, errno 126" until I added the following to my config in package.json.
"scripts": {
"start": "nodemon app/server.js"
}

Brand new react/node.js project wont run on opensuse

I'm currently learning Express and react right now and was able to run react app originally. While starting a new web app(Yesterday), I was not able to prevent a freshly created react app from crashing.
My OS:
openSUSE 20180522 <br>
Kernel: x86_64 Linux 4.16.9-1-default
The error:
$ npm start
> movieapp#0.1.0 start
/home/knosence/Templates/syntelBootCamp/react/movieapp
> react-scripts start
Attempting to bind to HOST environment variable: linux-gz59
If this was unintentional, check that you haven't mistakenly set it
in your shell.
Learn more here: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration
events.js:183
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND linux-gz59
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! movieapp#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the movieapp#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/knosence/.npm/_logs/2018-05-24T20_48_01_951Z-
debug.log
`
$ cat /home/knosence/.npm/_logs/2018-05-24T20_48_01_951Z-debug.log<br>
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node8', '/usr/local/bin/npm', 'start' ]
2 info using npm#6.0.1
3 info using node#v8.11.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle movieapp#0.1.0~prestart: movieapp#0.1.0
6 info lifecycle movieapp#0.1.0~start: movieapp#0.1.0
7 verbose lifecycle movieapp#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle movieapp#0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/knosence/Templates/syntelBootCamp/react/movieapp/node_modules/.bin:/home/knosence/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin:/snap/bin
9 verbose lifecycle movieapp#0.1.0~start: CWD: /home/knosence/Templates/syntelBootCamp/react/movieapp
10 silly lifecycle movieapp#0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle movieapp#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle movieapp#0.1.0~start: Failed to exec start script
13 verbose stack Error: movieapp#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid movieapp#0.1.0
15 verbose cwd /home/knosence/Templates/syntelBootCamp/react/movieapp
16 verbose Linux 4.16.9-1-default
17 verbose argv "/usr/bin/node8" "/usr/local/bin/npm" "start"
18 verbose node v8.11.2
19 verbose npm v6.0.1
20 error code ELIFECYCLE
21 error errno 1
22 error movieapp#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the movieapp#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
`
If anyone can help me with this then it will be greatly appreciated!! If anyone needs more information, let me know and I will provide. Thanks!
Your machine probably has a global HOST environment variable so Create React App tries to find an open port on it instead of the default localhost. Delete the environment variable and it should work fine as you want.
Maybe this answer will help you.
Create-react-app error
I faced the same issue and fixed it using
HOST=localhost npm start
Hope that it helps anyone else!

Resources