Closed sanmit123 closed 3 years ago
require() of D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js from D:\freelance\ionic-vendor_elocker\platforms\android\cordova\node_modules\execa\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\package.json.
This error has nothing to do with this plugin. Please build and run one of the example project apps to satisfy yourself of this.
Your plugin has required module strip-final-newline to add api key right?
@dpa99c
Your plugin has required module strip-final-newline to add api key right?
@dpa99c
no, this plugin does not require any dependencies in its package.json - the Google API is added using a Cordova plugin variable.
I suggest to run npm ls
to list the package tree and find out which parent module requires it.
Unable to add this plugin
I have added the api key for this plugin in config.xml `
All the required modules ae added as well but while I add plugin:
$ionic cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator
Output
Unable to load Platform API from D:\freelance\ionic-vendor_elocker\platforms\android\cordova\Api.js: Must use import to load ES Module: D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js require() of ES modules is not supported. require() of D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js from D:\freelance\ionic-vendor_elocker\platforms\android\cordova\node_modules\execa\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\package.json.
Failed to install 'uk.co.workingedge.phonegap.plugin.launchnavigator': Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js require() of ES modules is not supported. require() of D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js from D:\freelance\ionic-vendor_elocker\platforms\android\cordova\node_modules\execa\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\freelance\ionic-vendor_elocker\node_modules\strip-final-newline\package.json.