Chuckytuh opened a new issue #861:
URL: https://github.com/apache/cordova-lib/issues/861


   # Bug Report
   
   There's a behavioural mismatch between documentation ([cordova-cli 
doc](https://github.com/apache/cordova-cli/tree/master/doc#plugin-spec), 
(Website)[https://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html#plugin-spec])
 and what really happens when `cordova plugin add` is used when attempting to 
install a plugin from a git repo by specifying `git_ref` and `subdir`.
   
   ## Problem
   
   ### What is expected to happen?
   
   According to the documentation, one could do:
   
   ```
   cordova plugin add 
https://github.com/Chuckytuh/cordova-swift-plugins-test\#0.0.1:cordova-outsystems-swiftplugin42
   ```
   
   In order to install a plugin that is located in the provided github under 
the specified subdir.
   
   ### What does actually happen?
   
   Not what is documented. See:
   
   ```
   23:36:55 ❯ cordova plugin add 
https://github.com/Chuckytuh/cordova-swift-plugins-test\#0.0.1:cordova-outsystems-swiftplugin42
 --verbose
   No scripts found for hook "before_plugin_add".
   Calling plugman.fetch on plugin 
"https://github.com/Chuckytuh/cordova-swift-plugins-test#0.0.1:cordova-outsystems-swiftplugin42";
   fetch: Installing 
https://github.com/Chuckytuh/cordova-swift-plugins-test#0.0.1:cordova-outsystems-swiftplugin42
 to 
/Users/calcifer/Development/OutSystems/outsystems-mobile-rd/tmp/test-plugin-swift/myapp
   Running command: npm install 
https://github.com/Chuckytuh/cordova-swift-plugins-test#0.0.1:cordova-outsystems-swiftplugin42
 --save-dev
   Command finished with error code 1: npm 
install,https://github.com/Chuckytuh/cordova-swift-plugins-test#0.0.1:cordova-outsystems-swiftplugin42,--save-dev
   Failed to fetch plugin 
https://github.com/Chuckytuh/cordova-swift-plugins-test#0.0.1:cordova-outsystems-swiftplugin42
 via registry.
   Probably this is either a connection problem, or plugin spec is incorrect.
   Check your connection and plugin name/version/URL.
   CordovaError: Error: npm: Command failed with exit code 1 Error output:
   npm ERR! code 128
   npm ERR! Command failed: git checkout 0.0.1:cordova-outsystems-swiftplugin42
   npm ERR! fatal: Cannot switch branch to a non-commit 
'0.0.1:cordova-outsystems-swiftplugin42'
   npm ERR!
   
   npm ERR! A complete log of this run can be found in:
   npm ERR!     /Users/calcifer/.npm/_logs/2020-11-24T00_57_08_549Z-debug.log
   CordovaError: Failed to fetch plugin 
https://github.com/Chuckytuh/cordova-swift-plugins-test#0.0.1:cordova-outsystems-swiftplugin42
 via registry.
   Probably this is either a connection problem, or plugin spec is incorrect.
   Check your connection and plugin name/version/URL.
   CordovaError: Error: npm: Command failed with exit code 1 Error output:
   npm ERR! code 128
   npm ERR! Command failed: git checkout 0.0.1:cordova-outsystems-swiftplugin42
   npm ERR! fatal: Cannot switch branch to a non-commit 
'0.0.1:cordova-outsystems-swiftplugin42'
   npm ERR!
   
   npm ERR! A complete log of this run can be found in:
   npm ERR!     /Users/calcifer/.npm/_logs/2020-11-24T00_57_08_549Z-debug.log
       at 
/Users/calcifer/.nodenv/versions/12.19.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43
       at processTicksAndRejections (internal/process/task_queues.js:97:5)
   
   ```
   
   ## Information
   
   After debugging the install process, it is clear that `cordova-lib` is 
capable of parsing the required information from the URL (url, git_ref and 
subdir), sadly, when the times comes to fetch the plugin, `cordova-fetch` is 
executed which delegates to `npm install`, ending up failling because npm 
parses everything from `#` onwards as being the git_ref.
   
   
   
   ### Command or Code
   
   ```
   $ cordova create testapp
   $ cd testapp
   $ cordova platform add ios
   $ cordova plugin add 
https://github.com/Chuckytuh/cordova-swift-plugins-test\#0.0.1:cordova-outsystems-swiftplugin42
   ```
   
   
   
   ### Environment, Platform, Device
   
   Both Android and iOS
   
   
   ### Version information
   
   - cordova-cli: 10.0.0
   - cordova-ios: 6.1.1
   - macOS 10.15.7
   - zsh
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [X] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to