Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requireCordovaModule issue with cordova 9 #78

Open
mstrop opened this issue Mar 24, 2019 · 9 comments · May be fixed by #85
Open

requireCordovaModule issue with cordova 9 #78

mstrop opened this issue Mar 24, 2019 · 9 comments · May be fixed by #85

Comments

@mstrop
Copy link

mstrop commented Mar 24, 2019

After upgrading Cordova to version 9 I get this error message:

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

It's related to after_prepare.js file. Is there a way, how to fix this?

@vccrespo
Copy link

same problem here!

@flastowizka
Copy link

the same problem

@PeterHdd
Copy link

PeterHdd commented Apr 1, 2019

For anyone having issues with Cordova 9:

You can use the following plugin:

https://github.com/PeterHdd/cordova-plugin-crypto-file

I have updated it and now it works with Cordova 9.

to install it do the following:

npm i cordova-plugin-crypto-file@latest

@cyborgk9
Copy link

Thanks @PeterHdd.
I wasn't able to use Ionic as it can't guarantee the layout will be the same on every device. Instead I'm using Crosswalk. I referenced Peter's version to get a file that worked still.

In hooks/after_prepare.js, I changed:
var path = context.requireCordovaModule('path'), fs = context.requireCordovaModule('fs'), crypto = context.requireCordovaModule('crypto'), Q = context.requireCordovaModule('q'),

to:
var path = require('path'), fs = require('fs'), crypto = require('crypto'), Q = require('q'),

And:
var sourceFile = path.join(pluginDir, 'com/tkyaji/cordova/DecryptResource.java');

to:
var sourceFile = path.join(pluginDir, '../app/src/main/java/com/tkyaji/cordova/DecryptResource.java');

(I'm not really sure why the path is different... but that seemed to fix it. Something about the different 'path' object I guess).

I hope that helps others until this plugin gets updated (Please, @tkyaji ...?).

@PeterHdd
Copy link

@cyborgk9 you can just use the plugin I referenced, made it to work with the new ionic webview. But it can work even if you are not using ionic.

@cyborgk9
Copy link

cyborgk9 commented Apr 17, 2019

@cyborgk9 you can just use the plugin I referenced, made it to work with the new ionic webview. But it can work even if you are not using ionic.

@PeterHdd Hmm; well, my app seemed to render incorrectly until I installed cordova-plugin-ionic-webview, but that bypassed Crosswalk I guess, as there were other layout issues. Maybe there's a way to get Ionic running with Crosswalk, in which case I would use that and your plugin... (that'd be ideal, in fact...)

@jay34fr
Copy link

jay34fr commented Jun 21, 2019

Hi all,

Anyone find a solution for this plugin not working on Cordova 9 (not ionic) ?

I tried https://github.com/PeterHdd/cordova-plugin-crypto-file
It works on build, files are crypted but are not decrypted after installation.

Thx in advance.

n-poireault added a commit to eDialog-team/cordova-plugin-crypt-file that referenced this issue Jul 9, 2019
@n-poireault n-poireault linked a pull request Jul 9, 2019 that will close this issue
@tomavic
Copy link

tomavic commented Jan 3, 2020

you can use cordova 8 instead of 9

@premathunga
Copy link

platform : android 9
cordova : v.10.0.0

remove plugin
cordova plugin rm cordova-plugin-crypt-file

install plugin
cordova plugin add cordova-plugin-crypto-file@latest

latest version 1.4.0 fixes the cordova 9 issue.

weareu added a commit to weareu/cordova-plugin-crypt-file that referenced this issue Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants