cordova-docs icon indicating copy to clipboard operation
cordova-docs copied to clipboard

Warn not to use cygwin

Open cordiosd opened this issue 5 years ago • 8 comments

Warn not to use cygwin with cordova

Motivation Behind Feature

The cordova cli appears to be broken when performing certain operations which may lead to the abandonment or lack of adoption of cordova.

Feature Description

Just add a note on the installation page that not all operations work with cygwin.

I spent an embarrassing amount of time trying to figure out why the command "cordova plugin add" would fail when attempting to add a plugin from anywhere except the npm repository. Both the local file system and github failed similar to the following:

$ cordova plugin add ../cloned/cordova-plugin-fcm-with-dependecy-updated --verbose --save No scripts found for hook "before_plugin_add". No version specified for ../cloned/cordova-plugin-fcm-with-dependecy-updated, retrieving version from config.xml No version for null saved in config.xml Attempting to use npm info for null to choose a compatible release Error: Not found : com.test.cordova.install

I found this did work within "git bash" on windows.

Alternatives or Workarounds

Not using cygwin. Instead use "git bash", Powershell, ...

cordiosd avatar Apr 03 '19 18:04 cordiosd

I think a PR would be welcome:)

P.S. Some additional points:

  • ~~I think the same applies for mingw, for the same obvious reasons (not tested, not supported, more trouble than its worth given the number of excellent alternatives now available for Windows)~~ (my bad)
  • I would highly recommend that developers on Windows consider using https://cmder.net/, it is basically DOS-like cmd that acts like *nix shell and comes with lots of *nix-like features and utilities. I find it straightforward and powerful.

brody4hire avatar Apr 03 '19 20:04 brody4hire

Is the reason why this doesn't work known? Just reading this, it sounds very much like a bug that should be fixed - if that is possible.

janpio avatar Apr 03 '19 21:04 janpio

I don't have so much extra time to investigate this one.

brody4hire avatar Apr 03 '19 21:04 brody4hire

In my struggling with it, I had tried Cordova 7.0, 8.0, and 9.0. I then came across the following post which led me to consider changing my environment and discovered it was not cordova but in fact cygwin.

http://mail-archives.apache.org/mod_mbox/cordova-issues/201606.mbox/%[email protected]%3E

I installed cmder.net but unfortunately it does not seem to allow running tmux. If it does, how was not obvious to me.

For me, ideal development with cordova would be completely cross platform with either Visual Studio Code or the tmux/vim/plugins combination. Any suggestions on how I can get there with tmux and an ability to use an updated version of vim would be appreciated.

As far as I can tell, MinGW (Git Bash) is working well for cordova. But then again, perhaps something is not working that I just attributed to a bug in cordova and moved on.

Do you happen to have a git repository that serves as a "cordova test suite" that one could run to validate their environment is in fact working as expected?

Thank you for the impressive responsiveness to this issue.

cordiosd avatar Apr 04 '19 00:04 cordiosd

I then came across the following post which led me to consider changing my environment and discovered it was not cordova but in fact cygwin. [...]

That is really https://issues.apache.org/jira/browse/CB-11387 from the old bug system, and it looks to me like a valid bug on Cordova.

I raised apache/cordova#94 to track this.

FYI a slightly more modern mail list archive UI is available at: https://lists.apache.org/[email protected]

For me, ideal development with cordova would be [...]

Thanks, my response is in #961 (https://github.com/apache/cordova-docs/issues/961#issuecomment-479715898) where I think it belongs.

As far as I can tell, MinGW (Git Bash) is working well for cordova.

My bad, I missed it in the description.

Do you happen to have a git repository that serves as a "cordova test suite" that one could run to validate their environment is in fact working as expected?

AFAIK we generally test Cordova CLI manually and through the test suite in: https://github.com/apache/cordova-cli/tree/master/spec

We generally test the whole framework using https://github.com/apache/cordova-mobile-spec.

FYI here are a couple more pointers related to the development process:

brody4hire avatar Apr 04 '19 02:04 brody4hire

Created a new project, added Android platform, added local plugin:

OliverSalzburg@oliver-pc /cygdrive/d/foo
$ cordova plugin add ../Cordova\ Plugins/plugin-push --verbose --save
No scripts found for hook "before_plugin_add".
No version specified for ../Cordova Plugins/plugin-push, retrieving version from config.xml
No version for null saved in config.xml or package.json
Attempting to use npm info for null to choose a compatible release
Running command: npm view ../Cordova Plugins/plugin-push --json
Command finished with error code 0: npm view,../Cordova Plugins/plugin-push,--json
npm info for helloworld did not contain any engine info. Fetching latest release
Calling plugman.fetch on plugin "../Cordova Plugins/plugin-push"
fetch: Installing ../Cordova Plugins/plugin-push to D:\foo
Running command: npm install ../Cordova Plugins/plugin-push --production --save-exact
Command finished with error code 0: npm install,../Cordova Plugins/plugin-push,--production,--save-exact
Copying plugin "D:\foo\node_modules\fairmanager-cordova-plugin-push" => "D:\foo\plugins\fairmanager-cordova-plugin-push"
Calling plugman.install on plugin "D:\foo\plugins\fairmanager-cordova-plugin-push" for platform "android
Installing "fairmanager-cordova-plugin-push" for android
Running command: D:\foo\platforms\android\cordova\version
Command finished with error code 0: D:\foo\platforms\android\cordova\version
Running command: "D:\foo\platforms\android\cordova\version"
Command finished with error code 0: "D:\foo\platforms\android\cordova\version"
Finding scripts for "before_plugin_install" hook from plugin fairmanager-cordova-plugin-push on android platform only.
No scripts found for hook "before_plugin_install".
Install start for "fairmanager-cordova-plugin-push" on android.
PlatformApi successfully found for platform android
Beginning processing of action stack for android project...
Installing Android library: src/android/build-extras.gradle
Installing Android library: com.google.firebase:firebase-core:+
Installing Android library: com.google.firebase:firebase-messaging:+
Installing Android library: com.google.gms:google-services:+
Action stack processing complete.
Updating build files since android plugin contained <framework>
Subproject Path: CordovaLib
Subproject Path: app
Install complete for fairmanager-cordova-plugin-push on android.
Finding scripts for "after_plugin_install" hook from plugin fairmanager-cordova-plugin-push on android platform only.
No scripts found for hook "after_plugin_install".
Adding fairmanager-cordova-plugin-push to package.json
No scripts found for hook "after_plugin_add".

CygWin freshly downloaded and installed. Cordova 9.0

CygWin is by far the worst UNIX-like development tool to work with if you're looking for a cross-platform experience. Git Bash is the way to go IMHO. It's the one that works best out of the box and trying to achieve more will just drive you down a rabbit hole you don't want to be in.

oliversalzburg avatar Apr 04 '19 07:04 oliversalzburg

I just tried this with msys2 and it worked perfectly after I had it properly set up to inherit my window's paths and used its package manager, pacman, to install tmux and vim. msys2 is a much better fit than cygwin for this purpose.

http://www.msys2.org/

cordiosd avatar Apr 05 '19 00:04 cordiosd

Thanks guys for the valuable information. I would like to continue the discussion in #961.

brody4hire avatar Apr 05 '19 00:04 brody4hire

Closing out as not planned,

I have tested locally with Cygwin64 Terminal and didn't see any issues.

  • ran the terminal as administrator. (required for nvm to switch node versions)
  • installed and set successfully node 18.16.0 & npm 9.5.1. (with nvm)
  • installed successfully the latest Cordova-CLI 12
  • created successfully a cordova project with cordova create command
  • added successfully the latest [email protected] platform with cordova platform add command
  • cloned successfully with git in an external directory the same plugin as mentioned in the ticket cordova-plugin-fcm-with-dependecy-updated
  • added successfully the plugin cordova-plugin-fcm-with-dependecy-updated with the command cordova plugin add ../ cordova-plugin-fcm-with-dependecy-updated

I do not see any need to add documentation about Cygwin64 Terminal nor any other terminal tool.

I rarely hear anyone talk about or use Cygwin64 these days as well, so its probably low usage.

erisu avatar May 31 '23 09:05 erisu