從Ionic2公測RC3升級後,找不到命名空間 '谷歌'
我跑:
npm install --save @types/google-maps
裏面添加以下到我的package.json
:
"@types/google-maps": "^3.2.0",
我的index.html
有:
<script src="http://maps.google.com/maps/api/js"></script>
<script src="cordova.js"></script>
我的代碼包含:
declare var google: any;
...
public map: google.maps.Map = null;
,但我得到以下錯誤,當我運行ionic serve
:
Cannot find namespace 'google'.
在我的IDE(VSC),如果我點擊在google
,它帶我到node_modules\@types\googlemaps\index.d.ts
這似乎有正確的定義。
任何想法讚賞。
也許你忘了'NPM安裝google-maps --sa ve'? –
@SurajRao。我剛剛嘗試過:'npm install google-maps --save'。它似乎已經在我的'package.json'中添加了''google-maps':「^ 3.2.1」'',我想我仍然需要它,謝謝。但是當我嘗試運行'ionic serve'時,我仍然會遇到同樣的錯誤。 – Richard