Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to exec start script #6968

Open
florin1000 opened this issue May 2, 2019 · 11 comments
Open

Failed to exec start script #6968

florin1000 opened this issue May 2, 2019 · 11 comments

Comments

@florin1000
Copy link

florin1000 commented May 2, 2019

Is this a bug report?

Yes

Did you try recovering your dependencies?

(Write your answer here.)
yarn --version
1.15.2

Which terms did you search for in User Guide?

(Write your answer here if relevant.)
Failed to exec start script
react-scripts

Environment

(paste the output of the command here)
System:
OS: Linux 5.0 Antergos Linux
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Binaries:
Node: 11.14.0 - /usr/bin/node
Yarn: 1.15.2 - /usr/bin/yarn
npm: 6.9.0 - /usr/bin/npm
Browsers:
Chrome: Not Found
Firefox: 66.0.3
npmPackages:
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6
react-scripts: 3.0.0 => 3.0.0
npmGlobalPackages:
create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

  1. I have tried to use (again) the project starter for React (react-create-app) and after following the first 3steps of the official documentation the terminal throws an error when I try to start the project

Expected Behavior

(Write what you thought would happen.)
Compiled successfully!

You can now view project in the browser.

Local: http://localhost:3000/
On Your Network: http://10.1.0.116:3000/

Note that the development build is not optimized.
To create a production build, use yarn build.

Actual Behavior

(Write what happened. Please add screenshots!)
Starting the development server...

events.js:170
throw er; // Unhandled 'error' event
^

Error: spawn /usr/bin/chromium ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:247:19)
at onErrorNT (internal/child_process.js:429:16)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:253:12)
at onErrorNT (internal/child_process.js:429:16)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 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! /home/florin/.npm/_logs/2019-05-02T13_52_24_047Z-debug.log

And the log is

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v11.14.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle project@0.1.0prestart: project@0.1.0
6 info lifecycle project@0.1.0
start: project@0.1.0
7 verbose lifecycle project@0.1.0start: unsafe-perm in lifecycle true
8 verbose lifecycle project@0.1.0
start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/florin/WebstormProjects/project/node_modules/.bin:/home/florin/.local/bin:/home/florin/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
9 verbose lifecycle project@0.1.0start: CWD: /home/florin/WebstormProjects/project
10 silly lifecycle project@0.1.0
start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle project@0.1.0start: Returned: code: 1 signal: null
12 info lifecycle project@0.1.0
start: Failed to exec start script
13 verbose stack Error: project@0.1.0 start: react-scripts start
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:193:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:193:13)
13 verbose stack at maybeClose (internal/child_process.js:999:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid project@0.1.0
15 verbose cwd /home/florin/WebstormProjects/project
16 verbose Linux 5.0.10-arch1-1-ARCH
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v11.14.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error project@0.1.0 start: react-scripts start
22 error Exit status 1
23 error Failed at the project@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 ]

END

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)
Since i haven't added nothing extra to the react starter project I can't share you a link, is just the starting project that it has issues on my machine.
It is working if I change the version of the "react-scripts" from 3.0.0 - to 2.1.8

@DrKhyz
Copy link

DrKhyz commented May 4, 2019

I've got the same problem here on my Antergos (archlinux). I'm the only one with these error on my room (we are 30), but i'm the only one who use archlinux distro.
I think it's due to archlinux.

@rafafauzi
Copy link

I've got the same problem here too i also I change the version of the "react-scripts" from 3.0.0 - to 2.1.8
and its working

@ianschmitz
Copy link
Contributor

Hmm interesting. Looks like it's trying to launch Chrome but it's not available on your system...

You may want to try debugging the node_modules/react-dev-utils/openBrowser.js file. Take a look at

opn(url, options).catch(() => {}); // Prevent `unhandledRejection` error.
to see what it's trying to open.

Worst case you should be able to configure the BROWSER environment variable to disable the automatic browser open logic. See https://facebook.github.io/create-react-app/docs/advanced-configuration.

@DrKhyz
Copy link

DrKhyz commented May 4, 2019

I've found another solution more easy.
In your package.json, just add BROWSER=none before react-scripts start.
THis will not launch the browser, and you will not have errors

BROWSER=none react-scripts start

@florin1000
Copy link
Author

florin1000 commented May 5, 2019

I think I found the issue.
1)in the file mentioned above by @ianschmitz the getBrowserEnv function is reading the environment variable BROWSER and if, like in my case is /usr/bin/chromium and there is no such binary in the specified path it doesn't have what to open.

My Solution: set your BROWSER env variable to the right binary, in my case is

/usr/bin/google-chrome-stable with export BROWSER=/usr/bin/google-chrome-stable

or you can modify the file @ianschmitz getBrowserEnv function with the binary you desire,
set the value const: const value = "/usr/bin/your-binary-here"

I am wondering if this is a react-create-app bug for not cathcing this special case or an antergros error for not setting the env variable at installing google-chrome-stable!

@iansu iansu self-assigned this May 5, 2019
@tylerlaberge
Copy link

I'd like to add that this issue is present in WSL (Windows Sub System for Linux) as well. Setting the BROWSER env variable to none resolved the issue however. Alternatively, downgrading react-scripts to any version prior to 3.0.0 resolves the issue as well.

@philippguertler
Copy link

philippguertler commented Jun 5, 2019

For me, the issue was that the Antergos installer sets the BROWSER environment variable incorrectly.
Check env | grep BROWSER.

The Antergos installer adds the environment variable in these files:
https://github.com/Antergos/Cnchi/blob/b654b10b9933ff3f94a54b67699fc01a68ee47ae/scripts/postinstall.sh#L336-L339

Check and edit/remove the BROWSER line in these files.

Related issue in the Antergos installer: Antergos/Cnchi#1140

einaru added a commit to einaru/dotfiles that referenced this issue Jul 1, 2019
Setting the BROWSER var to 'gio open' was causing an error running react
apps created with create-react-app [1].

[1]: facebook/create-react-app#6968
@ghost
Copy link

ghost commented Jul 24, 2019

In your package.json, just add BROWSER=none before react-scripts start.

This worked for me. I use React through Windows 10 WSL and Docker. But this bug only occurs for me when I execute npm start directly within a tmux session. Not within WSL or Docker. Don't know if it is 100% related but maybe this will help.

@bigcoolge
Copy link

I have similar error.
My version of react-scripts is 3.2.0. I got the following error when running "yarn start"

Starting the development server...

events.js:183
throw er; // Unhandled 'error' event
^

Error: watch /home/tom/source/bigcoolge/apractice/reactjs/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/tom/source/bigcoolge/apractice/reactjs/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/tom/source/bigcoolge/apractice/reactjs/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/tom/source/bigcoolge/apractice/reactjs/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/home/tom/source/bigcoolge/apractice/reactjs/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher. (/home/tom/source/bigcoolge/apractice/reactjs/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher. (/home/tom/source/bigcoolge/apractice/reactjs/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

and then I run the "yarn build" and "yarn start" again, it is working.

@behnamazimi
Copy link

I have a similar issue, on Gitlab CI.

When the pipeline works, I get exactly the same error.

@Vishnu-Singh
Copy link

just similar problem
2021-02-25T04_29_50_528Z-debug.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants