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

Failed to install 'cordova-plugin-iroot': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported #48

Open
Gillardo opened this issue Oct 29, 2020 · 2 comments
Assignees

Comments

@Gillardo
Copy link

I cannot figure this error out, it only happens on this plugin and none others. I have upgraded to use cordova 9.0.0 and now this plugin throws the following error when trying to build for android

Discovered saved plugin "cordova-plugin-iroot". Adding it to the project
Installing "cordova-plugin-iroot" for android
Subproject Path: CordovaLib
Subproject Path: app
Failed to install 'cordova-plugin-iroot': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/Users/m2i/Desktop/appBundler/mobile/src/plugins/cordova-plugin-iroot/scripts/handle_plugin_preferences.js:6:22)
    at runScriptViaModuleLoader (/Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at process._tickCallback (internal/process/next_tick.js:68:7)
Failed to restore plugin "cordova-plugin-iroot" from config.xml. You might need to try adding it again. Error: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

All my plugins have been removed from the config.xml file and instead are in package.json. In there i have

    "cordova": "^9.0.0",
    "cordova-android": "^8.1.0",
    "cordova-plugin-iroot": "^2.1.0",

I have also tried to build the project with cordova-android: 9.0.0but i am getting the same exception.

I am also getting problems trying to build for ios as well, here is the exception

Installing "cordova-plugin-iroot" for ios
Failed to install 'cordova-plugin-iroot': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/Users/m2i/Desktop/appBundler/mobile/src/plugins/cordova-plugin-iroot/scripts/handle_plugin_preferences.js:6:22)
    at runScriptViaModuleLoader (/Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /Users/m2i/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at process._tickCallback (internal/process/next_tick.js:68:7)
Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

My package.json for ios is as follows

"cordova-ios": "^5.1.1",

I have tried uninstalling cordova using npm r cordova -g and then reinstalling but that doesnt seem to help.

Any help would be much appreciated.

@WuglyakBolgoink
Copy link
Owner

Hallo @Gillardo I do check for this.

what the node and npm versions you have?

@Gillardo
Copy link
Author

node = 10.15.3
npm = 6.13.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants