question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled rejection TypeError when loading page

See original GitHub issue

Hi- 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:closed
  • Created 7 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
snobearcommented, May 23, 2016

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:

npm install -g karma-cli

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 in package.json to look like

  "scripts": {
    "start": "set NODE_ENV=development&&node start-dev.js",
1reaction
GordyDcommented, May 23, 2016

Hi @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:

[x] Request for /bundle.js
Server router!

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 after app.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 the buildDirectory 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled Rejection (TypeError): Cannot read property 'map ...
The error means that data is undefined . · Put a breakpoint on setdata(result. · If that's the response from your server-side code...
Read more >
Window: unhandledrejection event - Web APIs | MDN
The unhandledrejection event is sent to the global scope of a script when a JavaScript Promise that has no rejection handler is rejected; ......
Read more >
Unhandled Rejection (TypeError): state.recipes is undefined
I am just trying to delete an item on my page. When I delete the item I get this Unhandled Rejection (TypeError): state....
Read more >
Unhandled Rejection (TypeError): model.describe is not a ...
Hi there, I am trying to run the example on the following page: https://github.com/ModelDepot/tfjsx, however I run into an error saying ...
Read more >
Tracking Unhandled Promise Rejections - TrackJS
When a promise is rejected, it looks for a rejection handler. If it finds one, like in the example above, it calls the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found