dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
570 stars 457 forks source link

TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ENOENT') #850

Closed kiransiemens closed 4 months ago

kiransiemens commented 5 months ago

When I am trying to install cordova-plugin-firebasex with cordova android 12, I am getting this error TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ENOENT')

KimberleyChee commented 5 months ago

i'm getting the same error running cordova build android with cordova android 12.

dpa99c commented 5 months ago

Please validate your local build environment by building the example project which is a known working codebase. Below is the console output of the example project building with the latest plugin version using cordova-android@12 in my local build environment.

If you can reproduce the error with the example project, please fill out the issue template including the full console output, appending the --verbose argument to the CLI command which raises the error. If the issue template is not filled out fully with your environment info and details of the error, I will be unable to investigate and this issue will be closed.

Console output

console output ``` $ cordova -v 12.0.0 (cordova-lib@12.0.1) $ node -v v16.13.2 $ cmd /c ver Microsoft Windows [Version 10.0.19045.3803] $ git clone https://github.com/dpa99c/cordova-plugin-firebasex-test Cloning into 'cordova-plugin-firebasex-test'... remote: Enumerating objects: 878, done. remote: Counting objects: 100% (207/207), done. remote: Compressing objects: 100% (83/83), done. remote: Total 878 (delta 145), reused 178 (delta 124), pack-reused 671 Receiving objects: 100% (878/878), 506.61 KiB | 1.12 MiB/s, done. Resolving deltas: 100% (513/513), done. $ cd cordova-plugin-firebasex-test/ $ cp ../../Git/cordova-plugin-firebasex-test/google-services.json . $ cordova plugin add cordova-plugin-firebasex@latest Adding cordova-plugin-firebasex to package.json $ cordova platform add android@12 Using cordova-fetch for cordova-android@12 Adding android project... Creating Cordova project for the Android platform: Path: platforms\android Package: uk.co.workingedge.firebase.test Name: FirebaseTest Activity: MainActivity Android Target SDK: android-33 Android Compile SDK: 33 Subproject Path: CordovaLib Subproject Path: app Android project created with cordova-android@12.0.1 Installing "cordova-plugin-customfcmreceiver" for android Installing "cordova-plugin-firebasex" for android Subproject Path: CordovaLib Subproject Path: app Discovered plugin "cordova-custom-config". Adding it to the project Installing "cordova-custom-config" for android Adding cordova-custom-config to package.json Discovered plugin "cordova-plugin-dialogs". Adding it to the project Installing "cordova-plugin-dialogs" for android Adding cordova-plugin-dialogs to package.json Discovered plugin "cordova-plugin-enable-multidex". Adding it to the project Installing "cordova-plugin-enable-multidex" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-enable-multidex to package.json Discovered plugin "cordova-plugin-androidx-adapter". Adding it to the project Installing "cordova-plugin-androidx-adapter" for android Adding cordova-plugin-androidx-adapter to package.json Discovered plugin "cordova-plugin-hello-c". Adding it to the project Installing "cordova-plugin-hello-c" for android Adding cordova-plugin-hello-c to package.json Discovered plugin "cordova.plugins.diagnostic". Adding it to the project Installing "cordova.plugins.diagnostic" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova.plugins.diagnostic to package.json Discovered plugin "cordova-plugin-facebook-connect". Adding it to the project Installing "cordova-plugin-facebook-connect" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-facebook-connect to package.json cordova-custom-config: Applied custom config from config.xml to D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\src\main\AndroidManifest.xml cordova-plugin-androidx-adapter: Processed 35 source files in 537ms cordova-plugin-firebasex: Preparing Firebase on Android cordova-plugin-firebasex: Updated colors.xml with accent color cordova-plugin-firebasex: Added tools namespace to AndroidManifest.xml $ cordova build android cordova-custom-config: Skipping auto-restore of config file backup(s) cordova-custom-config: Applied custom config from config.xml to D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\src\main\AndroidManifest.xml cordova-plugin-androidx-adapter: Processed 35 source files in 499ms cordova-plugin-firebasex: Preparing Firebase on Android Checking Java JDK and Android SDK versions ANDROID_HOME=G:\Users\dpa99\AppData\Local\Android\sdk (recommended setting) ANDROID_SDK_ROOT=G:\Users\dpa99\AppData\Local\Android\sdk (DEPRECATED) Using Android SDK: G:\Users\dpa99\AppData\Local\Android\sdk Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details Configuration on demand is an incubating feature. Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 22s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details Configuration on demand is an incubating feature. > Configure project :app WARNING:DSL element 'dexOptions' is obsolete and should be removed. It will be removed in version 8.0 of the Android Gradle plugin. Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically. strippedNativeLibsDir is deprecated and no longer used. Please remove it from your build configuration. > Task :CordovaLib:compileDebugRenderscript The RenderScript APIs are deprecated. They will be removed in Android Gradle plugin 9.0. See the following link for a guide to migrate from RenderScript: https://developer.android.com/guide/topics/renderscript/migrate > Task :CordovaLib:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :app:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 2m 54 actionable tasks: 54 executed Built the following apk(s): D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\build\outputs\apk\debug\app-debug.apk $ ```
dpa99c commented 4 months ago

If you are able to reproduce the issue in the example project, please open a new issue and fill out the issue template in full, including steps to reproduce in the example project and details of test devices used to reproduce the issue.

Lukenickerson commented 3 months ago

I am also running into this issue now on Windows with Cordova 12.0.0, node 20.5.0, Java 11.0.21, and cordova-android 12.0.1. I have Android Studio 2023.1.1 Patch 2 installed. When I run cordova platform rm android --verbose on a project that had previously added the android platform, I get the error:

No scripts found for hook "before_platform_rm". TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('EBUSY') at process.set [as exitCode] (node:internal/bootstrap/node:123:9) at C:\Programs\nvm\v20.5.0\node_modules\cordova\bin\cordova:32:22

When I try to remove the platforms directory with rm platforms (Yes to All), I get a number of WriteError ... IOException errors because some directories cannot be removed. Java is locking the file classes.dex for some reason, and the cordova platform rm android command is failing due to that -- but is providing a misleading error message.

After forcing java to quit, cordova platform rm android worked correctly.

maxmoridev commented 2 months ago

I have the same problem on MacOS... the problem for me was an xml node not closed correctly!!

If in the config.xml you have an xml node like this: <plugin name="cordova-plugin-someplugin">

when you try to run some command with Cordova, the NodeJs output is:

Error of type [ERR_INVALID_ARG_TYPE]: ...

After fixing the code in this line: <plugin name="cordova-plugin-someplugin" />

every other cordova command now seems to work correctly!!

dieterdreist commented 3 weeks ago

The example project does not build for me, it stops at "run ios":

# cordova run ios
cordova-custom-config: Skipping auto-restore of config file backup(s)
Overwriting existing resource file at platforms/ios/FirebaseTest/Resources/res/ios/sound/blackberry.caf
Overwriting existing resource file at platforms/ios/FirebaseTest/Resources/res/ios/sound/crystal.caf
Overwriting existing resource file at platforms/ios/FirebaseTest/Resources/res/ios/sound/msn.caf
Overwriting existing resource file at platforms/ios/FirebaseTest/Resources/res/ios/pn-actions.json
cordova-plugin-firebasex: Preparing Firebase on iOS
cordova-plugin-firebasex: cordova-plugin-firebasex: Applied post install block to Podfile
cordova-plugin-firebasex: cordova-plugin-firebasex: Added URL scheme "undefined"
Cannot read properties of undefined (reading 'replace')

This is the output of cordova requirements:

# cordova requirements

Requirements check results for ios:
Apple macOS: installed darwin
Xcode: installed 15.2
ios-deploy: installed 1.12.2
CocoaPods: installed 1.15.2