404 router.umd.js not found, Angular 2

I am trying to start an Angular 2 project and implemenet @angular/router.

The application works fine until I try:

import { provideRouter, RouterConfig } from '@angular/router';

because he is trying to find:

http://localhost:3000/node_modules/@angular/router/bundles/router.umd.js

that leads to:

Error: GET http://localhost:3000/node_modules/@angular/router/bundles/router.umd.js 404 (Not Found)

No /bundle/router.umd.js

Angular is trying to find this file because of:

var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'forms',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router',
    'router-deprecated',
    'upgrade',
];

// Bundled (~40 requests):
    function packUmd(pkgName) {
        packages['@angular/'+pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
    }

Here package.json:

...
  "dependencies": {
  "@angular/common":  "2.0.0-rc.3",
  "@angular/compiler":  "2.0.0-rc.3",
  "@angular/core":  "2.0.0-rc.3",
  "@angular/forms": "0.1.1",
  "@angular/http":  "2.0.0-rc.3",
  "@angular/platform-browser":  "2.0.0-rc.3",
  "@angular/platform-browser-dynamic":  "2.0.0-rc.3",
  "@angular/router":  "3.0.0-alpha.7",
...

I am trying to update a package using npm install @angular/router, but I get this error:

├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.3
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.3
└── @angular/router@3.0.0-alpha.7

I understand that Angular2 is still in beta. Any help here?

+4
source share
1 answer

I am sure that the package will change as long as it is still alpha, but until then you could pull it out of the ngPackageNames object and load it into the package object as

'@angular/router': { main: 'index.js', defaultExtension: 'js' }

,

, , , : Gist

+3

All Articles