简体   繁体   English

异常 nativeEvalAndFetch:ReferenceError:找不到变量:cordova

[英]exception nativeEvalAndFetch: ReferenceError: Can't find variable: cordova

I keep getting an error with Angular and Ionic, running on iOS simulator.在 iOS 模拟器上运行时,我不断收到 Angular 和 Ionic 的错误。

When running跑步时

ionic run ios

It was launching on the simulator fine.它在模拟器上正常启动。 Then I pressed the home button on the simulator and got然后我按下模拟器上的主页按钮并得到

exception nativeEvalAndFetch: ReferenceError: Can't find variable: cordova异常 nativeEvalAndFetch:ReferenceError:找不到变量:cordova

I was testing for deeplinking on my ionic app and this broke it.我正在测试我的离子应用程序的深层链接,这打破了它。

In order to fix, I put为了修复,我把

<script src="cordova.js"></script>

In my header.在我的标题中。 I had我有

<script src="phonegap.js"></script>

So now I have both in the header and it is working fine.所以现在我在标题中都有,并且工作正常。 Not sure if I need both or not, but it works.不确定我是否需要两者,但它有效。

Also, my phonegap.js lives in my app folder.此外,我的 phonegap.js 位于我的应用程序文件夹中。 So I add to the gruntfile so it will copy over when I grunt build.所以我添加到 gruntfile,这样当我 grunt build 时它就会复制过来。

This error occurred for me when I removed a plugin on another branch.当我删除另一个分支上的插件时,我发生了这个错误。 What I had to do is manually remove plugin and remove plugin info from package and config.我必须做的是手动删除插件并从包和配置中删除插件信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM