Unhandled rejection TypeError when loading page
See original GitHub issueHi- I’m trying to get started with 3ree but I can’t get it to run at all. When I run npm start on this project and then load localhost:3000 in a browser, the page never loads and I see this in the console output:
“C:\Program Files (x86)\JetBrains\WebStorm 2016.1\bin\runnerw.exe” “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” run-script start
3ree@1.0.0 start D:\repo\3ree set NODE_ENV=development & node server.babel.js & node server.webpack.js
WARNING: NODE_ENV value of 'development ’ did not match any deployment config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Setting up listener…
Listening for changes…
[x] Request for /
Server router!
[x] Request for /bundle.js
Server router!
Warning: Failed propType: Required prop router
was not specified in RouterContext
.
Warning: Failed propType: Required prop location
was not specified in RouterContext
.
Warning: Failed propType: Required prop routes
was not specified in RouterContext
.
Warning: Failed propType: Required prop params
was not specified in RouterContext
.
Warning: Failed propType: Required prop components
was not specified in RouterContext
.
Warning: [react-router] <RouterContext>
expects a router
rather than a history
Unhandled rejection TypeError: Cannot read property ‘listenBeforeLeavingRoute’ of undefined
at getChildContext (D:\repo\3ree\node_modules\react-router\lib\RouterContext.js:80:35)
at ReactCompositeComponentMixin._processChildContext (D:\repo\3ree\node_modules\react\lib\ReactCompositeComponent.js:413:53)
at ReactCompositeComponentMixin.performInitialMount (D:\repo\3ree\node_modules\react\lib\ReactCompositeComponent.js:297:127)
at ReactCompositeComponentMixin.mountComponent (D:\repo\3ree\node_modules\react\lib\ReactCompositeComponent.js:222:21)
at wrapper as mountComponent
at Object.ReactReconciler.mountComponent (D:\repo\3ree\node_modules\react\lib\ReactReconciler.js:39:35)
at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (D:\repo\3ree\node_modules\react\lib\ReactMultiChild.js:203:44)
at ReactDOMComponent.Mixin._createContentMarkup (D:\repo\3ree\node_modules\react\lib\ReactDOMComponent.js:593:32)
at ReactDOMComponent.Mixin.mountComponent (D:\repo\3ree\node_modules\react\lib\ReactDOMComponent.js:478:29)
at ReactDOMComponent.wrapper as mountComponent
at Object.ReactReconciler.mountComponent (D:\repo\3ree\node_modules\react\lib\ReactReconciler.js:39:35)
at ReactCompositeComponentMixin.performInitialMount (D:\repo\3ree\node_modules\react\lib\ReactCompositeComponent.js:297:34)
at ReactCompositeComponentMixin.mountComponent (D:\repo\3ree\node_modules\react\lib\ReactCompositeComponent.js:222:21)
at wrapper as mountComponent
at D:\repo\3ree\node_modules\react\lib\ReactServerRendering.js:38:38
at ReactServerRenderingTransaction.Mixin.perform (D:\repo\3ree\node_modules\react\lib\Transaction.js:136:20)
Also npm test fails to run- it generates this output because Windows refuses to run the karma executable (although this may be a stupid mistake I’m making):
.\node_modules\karma\bin\karma start
‘.\node_modules\karma\bin\karma’ is not recognized as an internal or external command, operable program or batch file.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “run-script” “test”
npm ERR! node v6.2.0
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! 3ree@1.0.0 test: .\node_modules\karma\bin\karma start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 3ree@1.0.0 test script ‘.\node_modules\karma\bin\karma start’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the 3ree package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! .\node_modules\karma\bin\karma start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs 3ree
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls 3ree
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! D:\repo\3ree\npm-debug.log
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (8 by maintainers)
RE: karma not running, you’ll need to install
karma-cli
to be able to use karma on windows. See the Commandline Interface section on karma’s site:then you can do
karma start
to fire the tests.Also, I do remember having some issues getting the npm start and run commands to work correctly for me on Windows. I had to change my
npm start
command inpackage.json
to look likeHi @jtiscione. @snobear is correct in that you should run the app from port 3001 - which is where the Webpack Dev Server is listening on.
The reason hitting up
http://localhost:3000
causes an error is because/bundle.js
(which is created by Webpack Dev Server) is not available from the App server on development. See the lines below from your error report:If you take a look at
server.js
, you can see the route configuration and in the event/bundle.js
has not matched any previous routes it results in the application producing this error afterapp.get('*', uni.handleRender);
is triggered and no React Router Route corresponding to bundle.js is found. Usually when running on production,/bundle.js
will have been built and exist in thebuildDirectory
so this error will not occur.I’ll look into adding some debugging here in the logs (telling users to try port 3001) so that this specific case is dealt with as it seems that this error has appeared twice in Issues now.