Search code examples
javascriptreactjsrestdebuggingcreate-react-app

Create react app randomly crashes every once in a while on code reload


This is pretty frustrating. I'm developing an app and this started happening a couple weeks ago and I can't nail down the cause. Every once in a while, the app will just crash. It seems to occur more often if I saved my code to trigger a reload, but it can also just randomly crash while navigating through the app in the browser.

As far as I can tell there are no obvious errors, and it happens at a random interval. Sometimes it'll happen twice in a minute, and other times it will go 30 minutes without occurring. Since there's no error that I can see, all I need to do is hit Control+C and re-run npm start, but it's still frustrating to have my workflow interrupted. The only thing I have is this error message in the console:

assert.js:339
    throw err;
    ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(index !== -1)

    at PriorityNode.removeChild (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\priority.js:74:3)
    at PriorityNode.remove (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\priority.js:62:15)
    at PriorityTree.add (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\priority.js:163:23)
    at Stream._initPriority (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\stream.js:101:25)
    at new Stream (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\stream.js:76:8)
    at Connection._createStream (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\connection.js:388:16)
    at Connection._handleHeaders (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\connection.js:436:21)
    at Connection._handleFrame (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\connection.js:319:10)
    at Parser.<anonymous> (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\connection.js:156:10)
    at Parser.emit (events.js:198:13)
    at addChunk (C:\Users\Admin\Desktop\project\frontend\node_modules\readable-stream\lib\_stream_readable.js:291:12)
    at readableAddChunk (C:\Users\Admin\Desktop\project\frontend\node_modules\readable-stream\lib\_stream_readable.js:278:11)
    at Parser.Readable.push (C:\Users\Admin\Desktop\project\frontend\node_modules\readable-stream\lib\_stream_readable.js:245:10)
    at Parser.Transform.push (C:\Users\Admin\Desktop\project\frontend\node_modules\readable-stream\lib\_stream_transform.js:148:32)
    at next (C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\protocol\base\parser.js:53:12)
    at C:\Users\Admin\Desktop\project\frontend\node_modules\spdy-transport\lib\spdy-transport\protocol\http2\parser.js:72:5
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!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2019-09-04T04_18_42_331Z-debug.log

and this log:

0 info it worked if it ends with ok
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' ]
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: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Admin\Desktop\project\frontend\node_modules\.bin;C:\Program Files\PostgreSQL\10\lib;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Admin\AppData\Local\Programs\Python\Python37-32;C:\Users\Admin\.cargo\bin;C:\Program Files\Java\jdk1.8.0_162\bin;C:\Users\Admin\.lein;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files (x86)\Yarn\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\Program Files\PostgreSQL\10\lib;C:\Users\Admin\.cargo\bin;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\Admin\AppData\Local\Yarn\bin;C:\Program Files\Java\jdk1.8.0_162\bin;C:\Users\Admin\AppData\Local\GitHubDesktop\bin;C:\Users\Admin\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\Users\Admin\Desktop\project\frontend
10 silly lifecycle [email protected]~start: Args: [ '/d /s /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> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:198: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:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Admin\Desktop\project\frontend
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.16.3
19 verbose npm  v6.9.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 ]

Does anyone have any ideas on what the cause might be or how I may further debug it?


Solution

  • You need to upgrade the spdy-transport version that you are using, per this issue: https://github.com/spdy-http2/spdy-transport/issues/62