Skip to content

capacitor run android command not called when eslint warnings are present #4807

Closed

Description

@mwahlhuetter

Description:
If there are any es-lint warnings present, the android apk is not automatically deployed to the target device.

Steps to Reproduce:
Create a new Ionic Project (in my case vue/ionic) and introduce a warning like an unused variable.
Run the command ionic cap run android -l --external
The process will stop after spinning up the vue-cli dev server and won't start the gradle build and the apk deployment.

Output:

? What platform would you like to run? android
? Which device would you like to target? samsung SM-G991B (R3CR307WQ1V)
> capacitor sync android
[capacitor] ✔ Copying web assets from dist to android/app/src/main/assets/public in 26.96ms
[capacitor] ✔ Creating capacitor.config.json in android/app/src/main/assets in 1.24ms
[capacitor] ✔ copy android in 48.82ms
[capacitor] ✔ Updating Android plugins in 5.79ms
[capacitor] [info] Found 5 Capacitor plugins for android:
[capacitor]        @capacitor/app@1.1.0
[capacitor]        @capacitor/haptics@1.1.4
[capacitor]        @capacitor/keyboard@1.2.1
[capacitor]        @capacitor/splash-screen@1.2.1
[capacitor]        @capacitor/status-bar@1.0.7
[capacitor] ✔ update android in 79.90ms
[capacitor] [info] Sync finished in 0.132s
[WARN] Multiple network interfaces detected!
       
       You will be prompted to select an external-facing IP for the dev server that your device or emulator can access.
       Make sure your device is on the same Wi-Fi network as your computer. Learn more about Live Reload in the docs[1].
       
       To bypass this prompt, use the --public-host option (e.g. --public-host=192.168.128.126). You can alternatively
       bind the dev server to a specific IP (e.g. --host=192.168.128.126).
       
       [1]: https://ion.link/livereload-docs
       
? Please select which IP to use: 192.168.128.126 (enp0s31f6)
> vue-cli-service serve
 WARNING  Compiled with 1 warning3:34:13 PM
[vue-cli-service] 
[vue-cli-service] /home/mwahlhuetter/projects/ape/app/src/components/LoginComponent.vue
[vue-cli-service]   37:11  warning  'test' is assigned a value but never used  @typescript-eslint/no-unused-vars
[vue-cli-service] 
[vue-cli-service] ✖ 1 problem (0 errors, 1 warning)
[vue-cli-service] 
[vue-cli-service] You may use special comments to disable some warnings.
[vue-cli-service] Use // eslint-disable-next-line to ignore the next line.
[vue-cli-service] Use /* eslint-disable */ to ignore all warnings in a file.

[vue-cli-service]   App running at:
[vue-cli-service]   - Local:   http://localhost:8100/ 
[vue-cli-service]   - Network: http://192.168.128.126:8100/
[vue-cli-service]   Note that the development build is not optimized.
[vue-cli-service]   To create a production build, run yarn build.
No issues found.

Expected Output:

...
[vue-cli-service]   App running at:
[vue-cli-service]   - Local:   http://localhost:8100/ 
[vue-cli-service]   - Network: http://192.168.128.126:8100/

[INFO] Development server running!
       
       Local: http://localhost:8100
       External: http://192.168.128.126:8100, http://192.168.128.207:8100
       
       Use Ctrl+C to quit this process

> capacitor run android --no-sync --target R3CR307WQ1V
[vue-cli-service]   Note that the development build is not optimized.
[vue-cli-service]   To create a production build, run yarn build.
No issues found.
[capacitor] ✔ Running Gradle build in 1.86s
[capacitor] ✔ Deploying app-debug.apk to R3CR307WQ1V in 5.25s

[INFO] App deployed to device!
       
       Development server will continue running until manually stopped.
       
       Use Ctrl+C to quit this process

My ionic info:

Ionic:

   Ionic CLI       : 6.18.1 (/home/mwahlhuetter/.config/yarn/global/node_modules/@ionic/cli)
   Ionic Framework : @ionic/vue 6.0.3

Capacitor:

   Capacitor CLI      : 3.4.0
   @capacitor/android : 3.4.0
   @capacitor/core    : 3.4.0
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 1.5.0

System:

   NodeJS : v14.18.2 (/usr/bin/node)
   npm    : 8.3.0
   OS     : Linux 5.10

Other Information:

Activity

  1. Kaes3kuch3n commented on Apr 24, 2022

    @Kaes3kuch3n

    The VueServeCLI's stdoutFilter is looking for one of the following messages to trigger the deployment: ['Compiled successfully', 'Compiled with warnings', 'Failed to compile']. But the ESLint warning in the cue-cli output reads Compiled with 1 warning, so I guess the VueServeCLI's stdoutFilter method needs to be updated to fix that :)

  2. aldencolerain commented on Jan 12, 2023

    @aldencolerain

    I think @Kaes3kuch3n is referring to this:

    const compileMsgs = ['Compiled successfully', 'Compiled with warnings', 'Failed to compile'];

  3. aldencolerain commented on Jan 12, 2023

    @aldencolerain

    I fixed this with the following patch (serve.patch):

    59c59
    <         const compileMsgs = ['Compiled successfully', 'Compiled with warnings', 'Failed to compile'];
    ---
    >         const compileMsgs = ['Compiled successfully', 'Compiled with', 'Failed to compile'];

    And patched via:
    patch -i serve.patch ./node_modules/\@ionic/cli/lib/project/vue/serve.js

  4. liamdebeasi commented on Dec 20, 2023

    @liamdebeasi
    Contributor

    Hi everyone,

    This was resolved via #5043, and the fix will be available in an upcoming version of the Ionic CLI.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions