Skip to content

'Npm start' fails on react-scripts-start initial attempt #3690

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

Closed
capndave opened this issue Jan 4, 2018 · 8 comments
Closed

'Npm start' fails on react-scripts-start initial attempt #3690

capndave opened this issue Jan 4, 2018 · 8 comments

Comments

@capndave
Copy link

capndave commented Jan 4, 2018

ISSUE

npm start is failing to work with create-react-app after initial 'create-react-app my-app' install. Complete output log is below.

I get similar output when trying to run another create-react-app that I copied in from another machine.

I initially tried this with node v8.9.4 and npm v5.6.0 and got the errors below.

I then installed a different node version using 'npm install -g npm@4', removed node_modules, cleared the cache, and ran another 'npm install'.

I then tried npm start with node v8.9.4 and npm v4.6.1, and got the same errors.

I searched for 'Exit status' and 'react-scripts start' in the documentation but didn't come up with anything.

running 'npm ls react-scripts' yields ' '[email protected] '

I'm using bash shell on Windows 10, and the latest version of Google Chrome.

INITIAL OUTPUT:

capndavet@PC102:/mnt/c/Users/dthompson/Documents/protest-app$ npm start
> [email protected] start /mnt/c/Users/dthompson/Documents/protest-app
> react-scripts start
os.js:126
  const interfaceAddresses = getInterfaceAddresses();                                                                                                ^     
Error: EINVAL: invalid argument, uv_interface_addresses
  at Object.networkInterfaces (os.js:126:30)
  at Function.address.interface (/mnt/c/Users/dthompson/Documents/protest-app/node_modules/address/lib/address.js:58:23)  
  at Function.address.ip (/mnt/c/Users/dthompson/Documents/protest-app/node_modules/address/lib/address.js:97:31)
  at err (/mnt/c/Users/dthompson/Documents/protest-app/node_modules/detect-port-alt/lib/detect-port.js:75:30)
  at Server.server.listen (/mnt/c/Users/dthompson/Documents/protest-app/node_modules/detect-port-alt/lib/detect-port.js:100:12)
  at Object.onceWrapper (events.js:313:30)
  at emitNone (events.js:106:13)
  at Server.emit (events.js:208:7)
  at emitListeningNT (net.js:1378:10)
  at _combinedTickCallback (internal/process/next_tick.js:135:11)
  at process._tickCallback (internal/process/next_tick.js:180:9)
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/capndavet/.npm/_logs/2018-01-04T16_27_50_082Z-debug.log `

DEBUG LOG

capndavet@PC102:/mnt/c/Users/dthompson/Documents$ cat /home/capndavet/.npm/_logs/2018-01-04T16_39_14_234Z-debug.log
 0 info it worked if it ends with ok
1 verbose cli [ '/home/capndavet/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli   '/home/capndavet/.nvm/versions/node/v8.9.4/bin/npm', 
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /home/capndavet/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/c/Users/dthompson/Documents/protest-app/node_modules/.bin:/home/capndavet/.nvm/versions/node/v8.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle [email protected]~start: CWD: /mnt/c/Users/dthompson/Documents/protest-app                          10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/capndavet/.nvm/versions/node/v8.9.4/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> (/home/capndavet/.nvm/versions/node/v8.9.4/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 [email protected]
15 verbose cwd /mnt/c/Users/dthompson/Documents/protest-app                                                             16 verbose Linux 3.4.0+
17 verbose argv "/home/capndavet/.nvm/versions/node/v8.9.4/bin/node" "/home/capndavet/.nvm/versions/node/v8.9.4/bin/npm" "start"                                                                                                                18 verbose node v8.9.4
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.                      24 verbose exit [ 1, true ]                                          

@capndave capndave changed the title 'Npm start' fails on initial attempt - fails on react-scripts-start 'Npm start' fails on react-scripts-start initial attempt Jan 4, 2018
@Timer Timer added this to the 1.0.x milestone Jan 4, 2018
@Timer Timer self-assigned this Jan 4, 2018
@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

@Timer Any ideas?

@Timer
Copy link
Contributor

Timer commented Jan 9, 2018

It looks like a Node bug on this specific users configuration, but we should probably make our fork of detect-port swallow it & emit a warning then return true (since an attempt of binding is better than nothing).

@weierophinney
Copy link

Just FYI: ran into the same just now, and my debug log is almost verbatim what is reported above. Node version 8.9.4, npm 5.6.0, running on linux.

When I ran an npm ls, I discovered that none of react, react-dom, or react-scripts were actually installed, which is odd, as I'd just created this project using the standard npx create-react-app command. Running npm install fetched them for me, fixing the issue.

@gaearon gaearon modified the milestones: 1.0.x, 1.0.18 Jan 14, 2018
@gaearon
Copy link
Contributor

gaearon commented Jan 14, 2018

For the original issue, this looks related: microsoft/WSL#468 Apparently fixed in this update: https://blogs.msdn.microsoft.com/commandline/2017/04/11/windows-10-creators-update-whats-new-in-bashwsl-windows-console/.

I don't know why a similar problem exists on Linux (per #3690 (comment)), but per the same report removing node_modules and doing an npm install seems to fix it.

I don’t think there’s anything that needs to be done on our side.

@gaearon gaearon closed this as completed Jan 14, 2018
@gaearon gaearon removed this from the 1.0.18 milestone Jan 14, 2018
@gaearon
Copy link
Contributor

gaearon commented Jan 14, 2018

Okay, let's keep it open to add basic error handling.

I think this is all we need:

-        listen(port, address.ip(), (err, realPort) => {
+        let ip;
+        try {
+          ip = address.ip();
+        } catch (err) {
+          return handleError(err);
+        }
+
+        listen(port, ip, (err, realPort) => {

While we're there, let's also figure out if we should cherry-pick node-modules/detect-port#26 into our fork.

@gaearon gaearon reopened this Jan 14, 2018
@gaearon gaearon added this to the 1.0.18 milestone Jan 14, 2018
gaearon added a commit to Timer/detect-port that referenced this issue Jan 14, 2018
@Timer
Copy link
Contributor

Timer commented Jan 14, 2018

Fixed via #3787

@Timer Timer closed this as completed Jan 14, 2018
@dhruv10
Copy link

dhruv10 commented Mar 11, 2018

Ran into the same just now, and my debug log is almost verbatim what is reported above. Node version 8.9.4, npm 5.7.1, running on linux mint 18.1.

Deleting node_modules and running npm install fetched them for me, but issue still persists. Please help.

@Timer
Copy link
Contributor

Timer commented Mar 12, 2018

Please file a new issue if you're experiencing problems.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants