facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.61k stars 26.79k forks source link

Error in the demo project, can't do the first run with npm. #7337

Open OtavioLara opened 5 years ago

OtavioLara commented 5 years ago

Describe the bug

The raw project isn't running after the creation:

` 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! dfm-front@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the dfm-front@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/otavio/.npm/_logs/2019-07-08T11_25_15_561Z-debug.log `

Log of this erros:

0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', 1 verbose cli '/usr/lib/node_modules/npm/bin/npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'start', 1 verbose cli '--scripts-prepend-node-path=auto' ] 2 info using npm@6.10.0 3 info using node@v11.15.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle dfm-front@0.1.0~prestart: dfm-front@0.1.0 6 info lifecycle dfm-front@0.1.0~start: dfm-front@0.1.0 7 verbose lifecycle dfm-front@0.1.0~start: unsafe-perm in lifecycle true 8 verbose lifecycle dfm-front@0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/otavio/dfm-front/node_modules/.bin:/home/otavio/.local/bin:/home/otavio/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 dfm-front@0.1.0~start: CWD: /home/otavio/dfm-front 10 silly lifecycle dfm-front@0.1.0~start: Args: [ '-c', 'react-scripts start' ] 11 silly lifecycle dfm-front@0.1.0~start: Returned: code: 1 signal: null 12 info lifecycle dfm-front@0.1.0~start: Failed to exec start script 13 verbose stack Error: dfm-front@0.1.0 start:react-scripts start 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/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.<anonymous> (/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 dfm-front@0.1.0 15 verbose cwd /home/otavio/dfm-front 16 verbose Linux 5.1.16-arch1-1-ARCH 17 verbose argv "/usr/bin/node" "/usr/lib/node_modules/npm/bin/npm-cli.js" "run" "start" "--scripts-prepend-node-path=auto" 18 verbose node v11.15.0 19 verbose npm v6.10.0 20 error code ELIFECYCLE 21 error errno 1 22 error dfm-front@0.1.0 start:react-scripts start 22 error Exit status 1 23 error Failed at the dfm-front@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 ]

Did you try recovering your dependencies?

I tried all the steps suggested however, nothing change. Same error as reported above.

I'm using ONLY npm.

npm --version = 6.10.0 create-react-app 3.0.1

Which terms did you search for in User Guide?

npm ERR! code ELIFECYCLE Error: spawn /usr/bin/chromium ENOENT

Environment

System: OS: Linux 5.1 Antergos Linux CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Binaries: Node: 11.15.0 - /usr/bin/node Yarn: Not Found npm: 6.10.0 - /usr/bin/npm Browsers: Chrome: Not Found Firefox: Not Found npmPackages: react: ^16.8.6 => 16.8.6 react-dom: ^16.8.6 => 16.8.6 react-scripts: 3.0.1 => 3.0.1 npmGlobalPackages: create-react-app: 3.0.1

Steps to reproduce

  1. remove chromium from your system.
  2. npx create-react-app anyapp
  3. cd anyapp
  4. npm run start

Expected behavior

Start the application fine with the demo page in localhost.

Actual behavior

It's happening the error posted above.

Reproducible demo

https://github.com/OtavioLara/dfm-frontend

OtavioLara commented 5 years ago

I fix my error. Its a little bit stranger: Chromium must be installed to make React works. I suggest adding the dependence of Chromium for the newest projects.

Californian commented 5 years ago

I get an error with (likely) the same cause.

Starting the development server...

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

Error: spawn google-chrome-unstable ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:247:19)
    at onErrorNT (internal/child_process.js:431: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:431:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! data-manager-gui@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the data-manager-gui@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/arodenius/.npm/_logs/2019-07-08T22_07_33_494Z-debug.log
heyimalex commented 5 years ago

I think our tooling can definitely be improved here; failing to open the browser shouldn't be a fatal error.

OtavioLara commented 5 years ago

I get an error with (likely) the same cause.

Starting the development server...

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

Error: spawn google-chrome-unstable ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:247:19)
    at onErrorNT (internal/child_process.js:431: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:431:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! data-manager-gui@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the data-manager-gui@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/arodenius/.npm/_logs/2019-07-08T22_07_33_494Z-debug.log

Try to install Chrome Albert, maybe it is the same solution.

Californian commented 5 years ago

@heyimalex I would very much consider this a bug; not only does chrome need to be installed, it must be the dev branch (at least on CentOS). Running on a headless server, this seems useless, considering that instance of Chrome won't even open. Preventing failure due to an unnecessary dependency seems like more than a proposal.

heyimalex commented 5 years ago

@Californian You're right. We have a bunch of issues on this, it's a bug in an underlying library that we're working to get fixed.

Californian commented 5 years ago

Ah so sorry, I didn't realize there were other issues. I searched, but maybe too specifically.

On Mon, Jul 22, 2019, 13:54 Alex Guerra notifications@github.com wrote:

@Californian https://github.com/Californian You're right. We have a bunch of issues on this, it's a bug in an underlying library that we're working to get fixed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/7337?email_source=notifications&email_token=AAIHR4Z2TCARXGUU3FXFTWLQAYNBJA5CNFSM4H63FMUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2REBXY#issuecomment-513949919, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIHR43377K6JDBVEZFMGDDQAYNBJANCNFSM4H63FMUA .

jcubic commented 3 years ago

Is there a way to disable opening the browser? Is there a configuration for this. I don't think it's a good idea to have magic numbers in terms of the browser that may be missing on the system where it is running. I use google-chrome on Fedora and I'm not able to run an application that was created with create-react-app because it tries to open in chromium-browser.

Starting the development server...

node:events:371
      throw er; // Unhandled 'error' event
      ^

Error: spawn chromium-browser ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480: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:288:12)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn chromium-browser',
  path: 'chromium-browser',
  spawnargs: [ 'http://localhost:3000' ]
}

Installing the browser for the library is like requiring to build a new airport just because there is this small plane that tries to land.

jcubic commented 3 years ago

Just as a workaround, at least on GNU/Linux and probably on MacOS ~/bin/ needs to exist and be in $PATH env variable.

ln -s /usr/bin/google-chrome-stable ~/bin/chromium-browser
heyimalex commented 3 years ago

@jcubic You can set the BROWSER env var to none.

jcubic commented 3 years ago

@heyimalex Thanks, this is probably the best solution. What about catching the error that showing proper error message:

"Browser not found try to set a BROWSER environment variable to none"