从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