dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 129 forks source link

Unable to add plugin #267

Closed sanmit123 closed 2 years ago

sanmit123 commented 2 years ago

Unable to add this plugin

I have added the api key for this plugin in config.xml `

</plugin>`

All the required modules ae added as well but while I add plugin: $ionic cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator

Output

cordova.cmd plugin add uk.co.workingedge.phonegap.plugin.launchnavigator Installing "uk.co.workingedge.phonegap.plugin.launchnavigator" for android Plugin dependency "cordova-plugin-actionsheet@2.3.3" already fetched, using that version. Installing "cordova-plugin-actionsheet" for android Failed to install 'cordova-plugin-actionsheet': 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.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (D:\freelance\ionic-vendor_elocker\platforms\android\cordova\node_modules\execa\index.js:5:27)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)

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.

at Function.Module._load (internal/modules/cjs/loader.js:790:14)

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.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (D:\freelance\ionic-vendor_elocker\platforms\android\cordova\node_modules\execa\index.js:5:27)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
dpa99c commented 2 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.

sanmit123 commented 2 years ago

Your plugin has required module strip-final-newline to add api key right?

@dpa99c

dpa99c commented 2 years ago

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.