2017-01-11 17 views
1

私のアプリケーションで使用する予定のモジュールが見つかりませんでしたが、問題があります。私は次のエラーを取得する:コンポーネントにインポートしたときにAngular2 - モジュールが見つかりません

GET http://product-admin.dev/node_modules/angular2-toaster/ 404 (Not Found) 

モジュールは、NPMを使用してインストールされ、モジュールのGitHubのレポは(https://github.com/Stabzs/Angular2-Toaster)ここにあります。

npm install angular2-toaster 

アプリケーションはnode_modulesフォルダ内でファイルを見つけることができないと思われますが、その理由はわかりません。私もnode_modules内のモジュールは、「angular2-トースター」と呼ばれるフォルダにそこにあるフォルダいることがわかります

import { FileUploaderDirective } from "./components/directives/files/FileUploaderDirective"; 
import { TabsDirective } from "./components/directives/tabs/TabsDirective"; 
import { PaginationDirective } from "./components/directives/pagination/PaginationDirective"; 

import { APIUrlPipe } from "./pipes/apiurl.pipe"; 
import { ToasterModule } from "angular2-toaster"; 


@NgModule({ 
    imports: [ 
     BrowserModule, 
     HttpModule, 
     FormsModule, 
     routing, 
     ToasterModule, 
     ReactiveFormsModule 

:ここに私のAngular2の関連セクションでは、ファイルapp.module.tsです。私はここに示したように、私はconfigオブジェクトのマッププロパティに行に追加して、これはSystemJSの設定の問題かもしれ考えていた。

/** 
* System configuration for Angular 2 samples 
* Adjust as necessary for your application needs. 
*/ 
(function (global) { 
    System.config({ 
     paths: { 
      // paths serve as alias 
      'npm:': 'node_modules/' 
     }, 
     // map tells the System loader where to look for things 
     map: { 
      // our app is within the app folder 
      app: 'app', 
      // angular bundles 
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
      // other libraries 
      'rxjs'      : 'npm:rxjs', 
      'angular2-toaster'   : 'npm:angular2-toaster', 
      'angular2-in-memory-web-api' : 'npm:angular2-in-memory-web-api', 
      "angular2-jwt"    : "npm:angular2-jwt/angular2-jwt.js" 
     }, 

これは、いずれかの任意の違いを作っているようには見えません。なぜこの問題が起こっているのか誰にでも見えますか?

ありがとうございました

答えて

2

私はこの作業をすることができました。私はSystemjs.config.jsファイルの 'packages'プロパティにエントリを追加するのを忘れていました。ここでそのファイルが修正され、現在作業中です。誰もがパッケージ名の違いで混乱している場合は、「ng2-toastr」と呼ばれる別のトースターパッケージを使用してしまいました。

/** 
* System configuration for Angular 2 samples 
* Adjust as necessary for your application needs. 
*/ 
(function (global) { 
    System.config({ 
     paths: { 
      // paths serve as alias 
      'npm:': 'node_modules/' 
     }, 
     // map tells the System loader where to look for things 
     map: { 
      // our app is within the app folder 
      app: 'app', 
      // angular bundles 
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
      // other libraries 
      'rxjs'      : 'npm:rxjs', 
      'ng2-toastr'     : 'npm:ng2-toastr', 
      'angular2-in-memory-web-api' : 'npm:angular2-in-memory-web-api', 
      "angular2-jwt"    : "npm:angular2-jwt/angular2-jwt.js" 
     }, 
     // packages tells the System loader how to load when no filename and/or no extension 
     packages: { 
      app: { 
       main: './main.js', 
       defaultExtension: 'js' 
      }, 
      rxjs: { 
       defaultExtension: 'js' 
      }, 
      'angular2-in-memory-web-api': { 
       main: './index.js', 
       defaultExtension: 'js' 
      }, 
      'angular2-jwt': { 
       'defaultExtension': 'js' 
      }, 
      'npm:ng2-toastr': { 
       main: './ng2-toastr.js', 
       defaultExtension: 'js' 
      } 
     } 
    }); 
})(this); 
関連する問題