2016-09-03 4 views
0

私はfountainJS Angular2ジェネレータをTypescriptとSystems.js を使ってプロジェクトを足場にしています。 https://github.com/FountainJS/generator-fountain-angular2FountainJS Angular2インストールコンポーネントangular2-google-maps問題

問題が発生しましたが、コンポーネントをプロジェクトに追加できません。 私は{GOOGLE_MAPS_DIRECTIVES} をインポート置くとき、私は「その https://angular-maps.com/docs/getting-started.html が「入門」セクションを経て、ファイルをjspm.config.jsが、私はドンするためにいくつかのコードを追加して、このエラーに

system.src.js:1057 GET http://localhost:3000/node_modules/angular2-google-maps/core/index.js 404 (Not Found) 

enter image description here

を取得私のプロジェクトの中にはangle-cli-build.jsファイルがあります。

マイjspm.config.js

SystemJS.config({ 
    packageConfigPaths: [ 
    'npm:@*/*.json', 
    'npm:*.json', 
    'github:*/*.json' 
    ], 
    map: { 
    'angular2-google-maps': 'node_modules/angular2-google-maps', 
    '@angular/common': 'npm:@angular/[email protected]', 
    '@angular/compiler': 'npm:@angular/[email protected]', 
    '@angular/core': 'npm:@angular/[email protected]', 
    '@angular/http': 'npm:@angular/[email protected]', 
    '@angular/platform-browser': 'npm:@angular/[email protected]', 
    '@angular/platform-browser-dynamic': 'npm:@angular/[email protected]', 
    '@angular/router': 'npm:@angular/[email protected]', 
    'es6-shim': 'npm:[email protected]', 
    'os': 'github:jspm/[email protected]', 
    'process': 'github:jspm/[email protected]', 
    'reflect-metadata': 'npm:[email protected]', 
    'rxjs': 'npm:[email protected]', 
    'ts': 'github:frankwallis/[email protected]', 
    'zone.js': 'npm:[email protected]' 
    }, 
    packages: { 
    'angular2-google-maps/core': { 
     defaultExtension: 'js', 
     main: 'index.js' // you can also use core.umd.js here, if you want faster loads 
    }, 
    'github:frankwallis/[email protected]': { 
     'map': { 
     'typescript': 'npm:[email protected]' 
     } 
    }, 
    'github:jspm/[email protected]': { 
     'map': { 
     'os-browserify': 'npm:[email protected]' 
     } 
    } 
    } 
}); 

答えて

0

node_modulesがnpm run serveが使用するWebサーバーで使用可能にされていないので、あなたがnode_modules/angular2-google-maps/core/index.js 404 (Not Found)を取得しています。

あなたがクライアントコードによってアクセスできるようにするnode_modulesが必要な場合は、conf/browsersync.conf.jsにそれのためにルートを追加する必要があります。また

routes: { 
    '/node_modules': 'node_modules', 

、あなたはangular2-グーグルマップをインストールする代わりに、NPMのJSPM使用することができます

jspm install angular2-google-maps 

jspmは、angular2-google-mapsの正しいマッピングを追加するためにjspm.config.jsを変更します。

しかし、404エラーが固定された後、私はおそらく発電噴水-angular2によってインストールis incompatible with angular2-rc4最新angular2-グーグルマップすることを意味している今

system.src.js:123 Uncaught (in promise) Error: (SystemJS) core_1.NgModule is not a function 
TypeError: core_1.NgModule is not a function 

を取得しています。