Solvedangular starter Uncaught TypeError: Cannot read property 'call' of undefined

  • I'm submitting a ...
    [x ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
  • What is the current behavior?
    loading app fails intermittently with error: Uncaught TypeError: Cannot read property 'call' of undefined

started a week or so ago when I upgraded from around the beta.8 versions. In the mean time I've tried starting from a fresh copy of the starter, it'll work fine for a while but eventually it'll fail on that error. Sometimes it'll fail after just adding a new

to an HTML template, or even just restarting the dev server

eventually the error is on this line:
modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));

it appears intermittently and seems to be random, it'll work one minute, and then fail the next. Making a couple changes (to nothing in particular) and restarting the dev server sometimes fixes it. And other times the app will be working fine but simply restarting the dev server will produce the error.

the same code also works fine when in a JSPM based build

  • Please tell us about your environment:

Node: v5.9.0
NPM: 3.7.3
Using the latest code from repo as of March 22/2016

  • Angular version: 2.0.0-beta.11

happens in multiple browsers (Firefox, Chrome, Opera)

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

polyfills.bundle.js:575 Uncaught TypeError: Cannot read property 'call' of undefined__webpack_require__ @ polyfills.bundle.js:575fn @ polyfills.bundle.js:99(anonymous function) @ main.browser.ts:5(anonymous function) @ main.bundle.js:734__webpack_require__ @ polyfills.bundle.js:575fn @ polyfills.bundle.js:99(anonymous function) @ multi_main:3(anonymous function) @ main.bundle.js:5__webpack_require__ @ polyfills.bundle.js:575webpackJsonpCallback @ polyfills.bundle.js:22(anonymous function) @ main.bundle.js:1

53 Answers

✔️Accepted Answer

I haven't found out the solution, but I've modified the webpack.config.js, removing vendor from CommonsChunkPlugin and now is working ok.

So the possible workaround is change from webpack.config.js:

new webpack.optimize.CommonsChunkPlugin({name: ['app', 'vendor', 'polyfills'], minChunks: Infinity}),


new webpack.optimize.CommonsChunkPlugin({name: ['app', 'polyfills'], minChunks: Infinity}),

It's not the best solution, but meanwhile we can continue with our development.

Other Answers:

+1 as above in Chrome, in firefox the error thrown is TypeError: modules[moduleId] is undefined

I am still getting this error message today. Did it break again?

I've narrowed my problem down to an import statement in one of my components, changed it from
import {Observable} from 'rxjs/Rx';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/forkJoin'

Seems to be working fine now.

updating to node 9.2.0 fixed the issue for me

More Issues: