Cordova-sqlite-storage: Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported.

Created on 27 Mar 2019  路  17Comments  路  Source: storesafe/cordova-sqlite-storage

sqlite plugins cannot be installed on Cordova 9, please adjust the plugin.

invalid question user community help ionic

Most helpful comment

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

Alternatively run these commands as one line:
ionic cordova platform rm ios; ionic cordova platform rm android; ionic cordova plugin rm cordova-sqlite-storage; npm i cordova-sqlite-storage@latest && ionic cordova plugin add cordova-sqlite-storage; ionic cordova platform add ios; ionic cordova platform add android

All 17 comments

Same here

Is the issue fixed? or should we revert to the older version of Cordova.

This plugin version should already be fixed.

What is the version containing the fix?

Can you give a try go to ./plugins/cordova-sqlite-storage/scripts/beforePluginInstall.js and add var Q = require('q') on the top of the file and comment out this line var Q = context.requireCordovaModule('q')? I was able to add the ios platform now.

Guys this should be resolved in the latest version (3.2.0). It was also resolved in 3.0.0. Please upgrade to the latest version as I do not have so much time to support questions on older plugin versions.

I'm not shure but I got the same issue when removing the old and then add the new plugin version. I solved this by removing all platforms. Then removing the plugins folder and add the platforms again. Be aware other plugins may also can cause this issue.

Thanks @DavidWiesner, reopening for now. I wonder if this should be raised on Cordova itself?

Tried @DavidWiesner 's solution and it didn't work while building on Ionic Pro. Any suggestions?

Closing as invalid. This plugin is already fixed. Please do the following:

  • completely remove plugins and platforms from your project
  • add plugins and platforms to .gitignore (plugins and platforms should not be committed)
  • update cordova-sqlite-storage to the most recent version (I do not support older versions)

In case anyone continues to see this kind of an issue with cordova-sqlite-storage then please make an example project according to https://stackoverflow.com/help/mcve.

I am getting the same error. What's the solution?
image

Hello I'm having the same issue how I fix it?

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

Alternatively run these commands as one line:
ionic cordova platform rm ios; ionic cordova platform rm android; ionic cordova plugin rm cordova-sqlite-storage; npm i cordova-sqlite-storage@latest && ionic cordova plugin add cordova-sqlite-storage; ionic cordova platform add ios; ionic cordova platform add android

Can you give a try go to ./plugins/cordova-sqlite-storage/scripts/beforePluginInstall.js and add var Q = require('q') on the top of the file and comment out this line var Q = context.requireCordovaModule('q')? For me now i was able to add the ios platform now.

It wroks for me thanks

Can you give a try go to ./plugins/cordova-sqlite-storage/scripts/beforePluginInstall.js and add var Q = require('q') on the top of the file and comment out this line var Q = context.requireCordovaModule('q')? I was able to add the ios platform now.

Works for Android as well. Thx!

Issues with a "q" module indicate use of an old version of this plugin in plugins or platforms directories. Old versions of this plugin are not supported and are known to be missing security and data integrity updates. Please check the following items very carefully:

  • no plugins configured in config.xml (Cordova should migrate plugins from config.xml but I have seen issues with this in the past)
  • remove outdated version of this plugin from package.json
  • ensure that there are no duplicate SQLite plugin versions in package.json (use of multiple SQLite plugins should be considered undefined behavior and may be different on iOS, Android, and other platforms)
  • use cordova plugin add command to add most recent version of this plugin, if it is not already configured

Then it should be possible to add and rebuild on Android, iOS, macOS ("osx"), and Windows.

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

Alternatively run these commands as one line:
ionic cordova platform rm ios; ionic cordova platform rm android; ionic cordova plugin rm cordova-sqlite-storage; npm i cordova-sqlite-storage@latest && ionic cordova plugin add cordova-sqlite-storage; ionic cordova platform add ios; ionic cordova platform add android

And also in conjunction with this too:
npm install -g [email protected]

Was this page helpful?
0 / 5 - 0 ratings