2016-10-07 7 views
5

」をGoogleの私は、プロジェクトが角-CLI活字のエラー:名前空間を見つけることができません

〜ルート〜/ srcに/ typings.json

{ 
    "globalDevDependencies": { 
    "angular-protractor": "registry:dt/angular-protractor#1.5.0+20160425143459", 
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255", 
    "selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654" 
    }, 
    "globalDependencies": { 
    "es6-shim": "registry:dt/es6-shim#0.31.2+20160602141504", 
    "google.maps": "registry:dt/google.maps#3.20.0+20160914131659" 
    } 
} 

〜ルート〜/タイピング/ index.d持っています.TS

/// <reference path="globals/angular-protractor/index.d.ts" /> 
/// <reference path="globals/es6-shim/index.d.ts" /> 
/// <reference path="globals/google.maps/index.d.ts" /> 
/// <reference path="globals/hammerjs/index.d.ts" /> 
/// <reference path="globals/jasmine/index.d.ts" /> 
/// <reference path="globals/selenium-webdriver/index.d.ts" /> 

〜ルート〜/ srcに/ tsconfig.json

{ 
    "compilerOptions": { 
    "declaration": false, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": ["es6", "dom"], 
    "mapRoot": "./", 
    "module": "es6", 
    "moduleResolution": "node", 
    "outDir": "../dist/out-tsc", 
    "sourceMap": true, 
    "target": "es5", 
    "typeRoots": [ 
     "../node_modules/@types", 
     "../typings" 
    ], 
    "files": [ 
     "../typings/index.d.ts" 
    ] 
    } 
} 

は を果たすNG実行後、私は、コンソール

ERROR in [default] F:~root~\src\app\ui\google-map\map-marker\map-marker.directive.ts:7:26

Cannot find namespace 'google'

ERROR in [default] ~root~\src\app\trip-entry-page\trip-entry-page.component.ts:188:21

Cannot find name 'google'

〜ルート〜\ SRC \アプリ\のUI \グーグルマップ\マップでエラーメッセージを持っています-marker \ map-marker.directive.ts:7:26

... 
@Input() veyoMapMarker: google.maps.MarkerOptions 
... 

〜ルート〜\のsrc \アプリケーション\トリップ・エントリ・ページ\旅行-エントリーpage.component.ts:188:21

... 
if (status === google.maps.DirectionsStatus.OK) { 
... 

正しいビルドアプリは

どのように作業した後、私はこのエラーメッセージを解決しますか?

+0

あなたは、この問題の解決策を見つけますか?私は同じ問題を抱えている。 –

+0

下記の回答がお手伝いしましたか?可能であれば、それを受け入れられた回答としてマークして、他の人がそれを見つけることができるようにします。 –

+0

ここで私の答えを参照してください:http://stackoverflow.com/a/42733315/1087131 私はCLI RC0を使用しています。 –

答えて

1

は後半の応答のビット

typings install dt~google.maps --global --save 
14

...ノードプロンプトで以下のコマンドを実行してみたが、私は角度CLI RC.0を使用して同様の問題がありました。

それは私がインストールしていなかったことが判明し、次のように行うことができますタイピングを、輸入:

npm install --save-dev @types/googlemaps 

import {} from '@types/googlemaps'; 
+0

入力されていない入力はありませんか?私がインストールした他のタイプ入力をインポートする必要がないということです。 –

+0

私はnode_modulesにnpmライブラリがあるので、通常は入力をインポートしません。今回は、実行時にGoogleマップスクリプトをダウンロードする必要があります。そのため、入力を個別にインポートする必要があります。私の完全な答えはこちら:http://stackoverflow.com/questions/36064697/how-to-install-typescript-typings-for-google-maps/42733315#42733315 –

関連する問題