0

When moving from Angular2 RC1 to RC2 I've run into some problems. One, which turned out to be because they changed the typings structure, was mentioned in this post about TS2300 Duplicate Identifier issues. After solving that, I'm seeing a lot of 404 errors relating to core and router modules.

Note:

@angular/core/core.umd.js not found and @angular/router/router.umd.js 404 (Not Found) errors

Because of these errors, angular never fires up and I'm stuck with my default HTML-based loading information rather than my app.

2 Answers 2

2

As mentioned in Angular2 RC2 quick-start article, please verify that you are running at least node v5.x.x and npm 3.x.x by running node -v and npm -v in a terminal/console window. Older versions produce errors.

I am able to run Angular2 RC quick-start application on my machine.

My environment is - Windows7 64bit OS, VScode 1.2.1, node v4.4.3, npm v3.9.6 and chrome browser.

UPDATE on 21-June:

Make sure you have latest systemjs.config.js file. Below block is added few days back after RC2 release-

  function packUmd(pkgName) {
    packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
  }
Sign up to request clarification or add additional context in comments.

Comments

1

The solution to this is buried in a small change in a tabbed systemjs.config.js file in the angular2 quickstart - very easy to overlook for someone just wanting to move up from RC1 to RC2 without reading every single word on the 'quickstart' page.

Note the suggested 'end' (everything after defining the npPackageNames array) of the system.config.js file for RC1 looked like this:

// Add package entries for angular packages
  ngPackageNames.forEach(function(pkgName) {
    packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
  });
  var config = {
    map: map,
    packages: packages
  }
  System.config(config);
})(this);

whereas the new suggested 'end' of the system.config.js file for RC now looks like this:

  // Individual files (~300 requests):
  function packIndex(pkgName) {
    packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
  }
  // Bundled (~40 requests):
  function packUmd(pkgName) {
    packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
  }
  // Most environments should use UMD; some (Karma) need the individual index files
  var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
  // Add package entries for angular packages
  ngPackageNames.forEach(setPackageConfig);
  var config = {
    map: map,
    packages: packages
  };
  System.config(config);
})(this);

Making this change let's everyone know where to find the router.umd.js, platform-browser-dynamic, http.umd.js and the core.umd.js files. ... which allows the app to fire up.

1 Comment

Also, there's no router.umd.js file for v3.alpha yet, if you want to use that one, you'll need to configure systemjs to work with individual index files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.