6

I have a JSPM/Typescript/Angular 1.5.3 project. I want to use the new component router. In my project dir, I used the command

jspm install npm:@angular/router

which installed fine with no errors. I then added it to my app.ts file with

import ngComponentRouter from 'jspm_packages/npm/@angular/router@0.2.0/angular1/angular_1_router'

But when I start my lite-server, I get

Failed to load resource: the server responded with a status of 404 (Not Found) 
http://localhost:3000/jspm_packages/npm/@angular/instruction.json

Failed to load resource: the server responded with a status of 404 (Not Found) 
http://localhost:3000/jspm_packages/npm/@angular/utils.json

Failed to load resource: the server responded with a status of 404 (Not Found) 
http://localhost:3000/jspm_packages/npm/@angular/url_parser.json

I'm not sure why it wants to load these mysterious JSON files, so I checked my package.json:

{
  "jspm": {
    "name": "app",
    "dependencies": {
      "": "npm:@angular/router@^0.2.0",
      "angular": "npm:angular@^1.5.3", 

Hmmm...that empty "" doesn't look right. I feel like there's a build step missing if JSPM can't resolve a package name and the router is asking for JSON files. What am I doing wrong here?

gmuraleekrishna
  • 3,375
  • 1
  • 27
  • 45
zakdances
  • 22,285
  • 32
  • 102
  • 173
  • I get the same 404s, but my jspm dependencies shows the (expected?) `"@angular/router": "npm:@angular/router@^0.2.0"`. Still no closer to a resolution though. – Squiggle Apr 07 '16 at 10:25
  • @Squiggle Do `jspm uninstall @angular/router` and then try `jspm install npm:ngcomponentrouter` – zakdances Apr 08 '16 at 07:57
  • I tried using that, but I'm getting an error `Component "Root" has no route config.` - which either means I need to configure something that isn't documented in the guide, or it looks like this is the wrong version. Did you get it working OK? – Squiggle Apr 08 '16 at 08:36
  • 1
    Working now. Thanks! The error was quite misleading - whilst I had set the root component, I had not loaded a module which contained a referenced component. (facepalm) – Squiggle Apr 08 '16 at 09:16

0 Answers0