0

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! [email protected] start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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

6
  • Have you tried solutions provided here: stackoverflow.com/questions/16604176/… Commented Oct 6, 2020 at 5:09
  • Hi. Thank you for your reply. I tried them just now. The accepted solution I thin kdoesn't apply to me, since this simple app only uses imports. Would I need to put __dirname on the imports? Here are some of my other attempts: jglickman@devapp01:~/git/test/myfirstreact$ node src/App.js /home/jglickman/git/test/myfirstreact/src/App.js:1 import React from 'react'; ^^^^^ SyntaxError: Unexpected identifier Commented Oct 7, 2020 at 7:05
  • Did you tried other solutions? like running in parenthesis and running it like nohup node server.js </dev/null Commented Oct 8, 2020 at 3:40
  • Hi. Here are the results: joshua@joshua-KVM:~/git/test/myfirstreact$ node server.js internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module '/home/joshua/git/test/myfirstreact/server.js' joshua@joshua-KVM:~/git/test/myfirstreact$ cd src joshua@joshua-KVM:~/git/test/myfirstreact/src$ node server.js internal/modules/cjs/loader.js:638 throw err; ^ Error: Cannot find module '/home/joshua/git/test/myfirstreact/src/server.js' Commented Oct 11, 2020 at 2:52
  • I believe this is because there is no such file as server.js :) Commented Oct 11, 2020 at 2:53

1 Answer 1

0

Try running it like this:

nohup node scripts/start.js  

I think this post will help too.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.