[英]ionic cordova run android not working. Giving error for strip-final-newline
I am trying to use Background Geolocation in ionic.我正在尝试在离子中使用背景地理定位。 When I run
ionic cordova run android
it is giving me following error:当我运行
ionic cordova run android
它给了我以下错误:
> cordova.cmd build android
cordova-android-support-gradle-release: ERROR: EXCEPTION: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\xampp\htdocs\myApp\node_modules\strip-final-newline\index.js
require() of ES modules is not supported.
require() of C:\xampp\htdocs\myApp\node_modules\strip-final-newline\index.js from C:\xampp\htdocs\myApp\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 C:\xampp\htdocs\myApp\node_modules\strip-final-newline\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\xampp\htdocs\myApp\node_modules\strip-final-newline\package.json.
Unable to load Platform API from C:\xampp\htdocs\myApp\platforms\android\cordova\Api.js:
Must use import to load ES Module: C:\xampp\htdocs\myApp\node_modules\strip-final-newline\index.js
require() of ES modules is not supported.
require() of C:\xampp\htdocs\myApp\node_modules\strip-final-newline\index.js from C:\xampp\htdocs\myApp\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 C:\xampp\htdocs\myApp\node_modules\strip-final-newline\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\xampp\htdocs\myApp\node_modules\strip-final-newline\package.json.
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk
[native-run] No hardware devices found, attempting emulator...
[native-run] ERR_NO_TARGET: No targets devices/emulators available. Cannot create AVD because there is no suitable API installation. Use --sdk-info to reveal missing packages and other issues.
[native-run]
[native-run] More details for this error may be available online:
[native-run]
[native-run] https://github.com/ionic-team/native-run/wiki/Android-Errors
[ERROR] An error occurred while running subprocess native-run.
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
After installing npm install strip-final-newline
I am finding above error Could you please help?安装
npm install strip-final-newline
我发现上面的错误你能帮忙吗?
I had the same problem我有同样的问题
I uninstalled strip-final-newline and then downgraded to 2.0.0 with我卸载了 strip-final-newline 然后降级到 2.0.0
npm install strip-final-newline@2.0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.