Skip to content

ionic command fails to find cordova/scripts when on a linux machine accessed from a cygwin terminal #4245

Closed

Description

@cgreenhalgh

Description:

When using ionic on a linux VM from a cygwin terminal the CLI cannot find cordova or ionic-app-scripts although they are installed.

Turns out this is because

  • by default the environment variable TERM will be set to "cygwin",
  • and the ionic terminal utils use this as a heuristic to decide it is running on Windows,
  • and the ionic shell utils use this terminal windows flag to decide to process the path as if it was on windows when trying to execute commands,
  • which results in the commands not being found/run
  • which the CLI interprets as commands (such as cordova) not being installed

There's a workaround (at the bottom) but a better default behaviour, or a better runtime check would save a lot of time chasing down this issue.

Steps to Reproduce:

Open a cygwin terminal in windows, ssh to a machine/VM running Linux with
ionic/cordova installed and cd to an ionic/cordova project and try ionic info (or ionic build etc)

Output:

$ ionic info

Ionic:

   Ionic CLI          : 5.4.10 (/home/ubuntu/.config/yarn/global/node_modules/io
nic)
   Ionic Framework    : ionic-angular 3.9.9
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : not installed
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

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

System:

   Android SDK Tools : 26.1.1 (/home/ubuntu)
   NodeJS            : v11.15.0 (/home/ubuntu/.nvm/versions/node/v11.15.0/bin/no
de)
   npm               : not installed
   OS                : Linux 4.4


  ─────────────────────────────────────────────────

     Ionic CLI update available: 5.4.10 → 5.4.11
            Run npm i -g ionic to update

  ─────────────────────────────────────────────────

My ionic info:

see above

Other Information:

Workaround, change the terminal type to something else, e.g.

$ TERM=ansi; ionic info

Ionic:

   Ionic CLI          : 5.4.10 (/home/ubuntu/.config/yarn/global/node_modules/io
nic)
   Ionic Framework    : ionic-angular 3.9.9
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic
-webview 4.1.3, (and 25 other plugins)

Utility:

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

System:

   Android SDK Tools : 26.1.1 (/home/ubuntu)
   NodeJS            : v11.15.0 (/home/ubuntu/.nvm/versions/node/v11.15.0/bin/no
de)
   npm               : 6.7.0
   OS                : Linux 4.4

=> all good.

Activity

  1. imhoffd commented on Dec 9, 2019

    @imhoffd
    Contributor

    Thanks for the detailed issue. I'm confused as to how TERM is set to cygwin on your Linux machine.

  2. cgreenhalgh commented on Dec 10, 2019

    @cgreenhalgh
    Author

    I'm using a Windows machine, with cygwin, virtualbox and vagrant. I am using ionic/cordova in a ubuntu VM running in virtualbox on that machine, and accessing it (using vagrant ssh which uses cygwin's ssh) from a cygwin terminal. So ssh sets the TERM type to cygwin.

  3. imhoffd commented on Dec 10, 2019

    @imhoffd
    Contributor

    Wow, I never knew ssh set TERM, but I guess that makes sense.

    I think we can safely remove the TERM check. The Node process.platform detection is very good.

  4. imhoffd commented on Dec 10, 2019

    @imhoffd
    Contributor

    This is in CLI 5.4.12. Thanks!

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