ค้นหาเว็บไซต์

typescript - การติดตั้ง Angular component router ผ่าน JSPM ส่งผลให้เกิดข้อผิดพลาด 404 ลึกลับ


ฉันมีโครงการ JSPM/Typescript/Angular 1.5.3 ฉันต้องการใช้ตัวจัดการเส้นทางคอมโพเนนต์ใหม่ ในไดเรกทอรีโครงการของฉัน ฉันใช้คำสั่ง

jspm install npm:@angular/router

ซึ่งติดตั้งได้เรียบร้อยโดยไม่มีข้อผิดพลาด จากนั้นฉันก็เพิ่มมันเข้าไปในไฟล์ app.ts ของฉันด้วย

import ngComponentRouter from 'jspm_packages/npm/@angular/[email /angular1/angular_1_router'

แต่เมื่อฉันเริ่ม lite-server ของฉัน ฉันได้รับ

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

ฉันไม่แน่ใจว่าทำไมมันถึงต้องการโหลดไฟล์ JSON ลึกลับเหล่านี้ ดังนั้นฉันจึงตรวจสอบไฟล์ package.json ของฉัน:

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

อืมม... "" ว่างๆ นั่นดูไม่ถูกต้องเลย ฉันรู้สึกเหมือนว่ามีขั้นตอนการสร้างหายไปถ้า JSPM ไม่สามารถแก้ไขชื่อแพ็กเกจได้ และตัว Router ขอไฟล์ JSON ฉันทำอะไรผิดตรงไหนหรือเปล่า?

บทความที่เกี่ยวข้อง