cordova - Failed: q is not supported

巧了我就是萌 提交于 2020-02-23 09:10:29

问题


When I build cordova this message view:

Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

How fix this problem?

PS. I updated npm before this build problem. So it was not problem buildings before update. Sorry my English))


回答1:


Solved this problem by installing a lower version of cordova. Seems like every version of cordova that is > 8.1.1 breaks a number of plugins.

For instance, the plugin cordova-sqlite-storage failed to install with the following error message:

Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

To solve that issue, I simply removed cordova by calling npm uninstall cordova -g and then installed it globally again with npm install -g cordova@8.1.1

After that fix, no more errors are getting displayed and cordova-sqlite-storage gets installed smoothly!!

Installing "cordova-sqlite-storage" for android




回答2:


**In my case the following sequence fixed that issue:

Remove ios platform ionic cordova platform rm ios

Remove android platform ionic cordova platform rm android

Remove sqlite storage plugin ionic cordova plugin rm cordova-sqlite-storage

Install latest sqlite storage npm package npm i cordova-sqlite-storage@latest

Install sqlite storage plugin ionic cordova plugin add cordova-sqlite-storage

Add ios platform ionic cordova platform add ios

Add android platform ionic cordova platform add android




回答3:


Just run npm i cordova-sqlite-storage This would upgrade the plugin to the latest version in which this issue is already solved.



来源:https://stackoverflow.com/questions/55302204/cordova-failed-q-is-not-supported

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!