angular: 404 - Extra slash in import /router//bundles/router.umd.js

I’m submitting a … (check one with “x”)

[ X ] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior 404 Error http://localhost:3000/node_modules/@angular/router//bundles/router.umd.js

Angular seems to be adding an extra / after router and before bundles folder

Expected/desired behavior

I expect the path to be only one slash

Reproduction of the problem https://github.com/sethdorris/practice_angular2

just clone my github repo and “npm start”

What is the expected behavior? The error does not occur when you remove the bootstrapping of the application with APP_ROUTER_PROVIDERS

What is the motivation / use case for changing the behavior? I am trying to use Angular Router

Please tell us about your environment:

  • Angular version: 2.0.0-rc.2
  • Angular Router Version. 3.0.0-alpha.7
  • Browser: Chrome 51.0.2704.103 m (64-bit)
  • Language: TypeScript 1.8.10

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 21 (2 by maintainers)

Most upvoted comments

This is an issue with your SystemJS config: https://github.com/sethdorris/practice_angular2/blob/master/systemjs.config.js#L36

Removed the / before bundles

This is no longer a issue. Please issue npm uninstall @angular/router --save and then npm install @angular/router --save to install the package again. It works for me now.

Idk why but my @angular/router had no bundle folder so I resorted to using packIndex just for router.

– Update

packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };

fixes this manually.

Yeah and you need to remove it from the package list.

/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function(global) {
  // map tells the System loader where to look for things
  var map = {
    'app':                        '', // 'dist',
    '@angular':                   'node_modules/@angular',
    'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
    'rxjs':                       'node_modules/rxjs'
  };
  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'app':                        { main: 'main.js',  defaultExtension: 'js' },
    'rxjs':                       { defaultExtension: 'js' },
    'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
  };
  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'forms',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router-deprecated',
    'upgrade',
  ];
  // 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);
  packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };
  var config = {
    map: map,
    packages: packages
  };
  System.config(config);
})(this);

RC4 package.json (latest as of now) file breaks the Tour of Heroes tutorial.

You get the following error:

platform-browser.umd.js:1900 EXCEPTION: Template parse errors: Can't bind to 'routerLink' since it isn't a known native property

Edit: Overlooked importing ROUTER_DIRECTIVES to app.component as well as adding it as a directive to the AppComponent class.

I dont think it’s a right choice. As it was mentioned above, I’m trying to follow Tour of Heroes tutorial. Before adding routing it works perfectly fine. And just after routing stuff this error occurs.

Sad, but it hasn’t worked for me. After uninstall/install I’ve got a bunch of errors about routerLink isn’t a native property.