apache / cordova-fetch

Apache Cordova Fetch Library
https://cordova.apache.org/
Apache License 2.0
27 stars 27 forks source link

Fails to get the installed target package name #59

Closed GedasGa closed 5 years ago

GedasGa commented 5 years ago

In the getTargetPackageSpecFromNpmInstallOutput method, if the dependency or sub-dependency have a postinstall, for example electron package, it will print out extra lines:

> electron@3.1.1 postinstall /cordova-project/node_modules/electron
> node install.js 

Because of this additional print, the getTargetPackageSpecFromNpmInstallOutput method fails to parse properly the printout for the package name.

Appending the --silent flag would hide the addition printout and maintain the proper parsing. However, the --silent flag would prevent showing npm ERR! output on error. and they would be printed just in the .log file.

As a recommendation it would be better to loop through the printout and look for a particular format.


The steps for reproduce:


$ npx cordova@nightly create cordova-project
$ cd cordova-project
$ npx cordova@nightly platform add github:apache/cordova-electron

The steps above uses Nightly to test the Electron for Cordova 9 release.


Error:


Using cordova-fetch for github:apache/cordova-electron
Failed to fetch platform github:apache/cordova-electron
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Could not determine package name from output:
> electron@3.1.1 postinstall /cordova-procject/node_modules/electron
> node install.js

+ cordova-electron@1.0.0-dev
erisu commented 5 years ago

GH-60, which contains this fix has been merged into master.