Comments (10)
Is git+
even still valid? I remember npm had some issue with it a time ago. Anyways, installing from Git just works like this:
cordova plugin add https://github.com/wbt11a/Canvas2ImagePlugin.git\#6195584c2b
from cordova-fetch.
I've fought variations of this for years, with most reliable format to install from github is using the same github:
syntax as npm:
cordova plugin add github:wbt11a/Canvas2ImagePlugin#6195584c2b
from cordova-fetch.
thanks @timbru31 @dpogue. Npm install support github, https and git all. but this not my problem.
My problem is npa(npm-package-arg) won't
resolve name of the plugin whose repo like https://,git://,GitHub:.So cordova-fetch will exec npm to install it, but it exists already.
from cordova-fetch.
@timbru31 NPM automatically converts git urls to git+
I've failed to reproduce this on:
9.0.0 ([email protected])
[email protected]
My output:
norman@norman-ThinkPad:/development/cordova/tests/android29$ cordova plugin add https://github.com/wbt11a/Canvas2ImagePlugin.git#6195584c2b
Installing "org.wbt11a.Canvas2ImagePlugin" for android
Adding org.wbt11a.Canvas2ImagePlugin to package.json
norman@norman-ThinkPad:/development/cordova/tests/android29$ cordova plugin add https://github.com/wbt11a/Canvas2ImagePlugin.git#6195584c2b
Plugin "org.wbt11a.Canvas2ImagePlugin" already installed on android.
Adding org.wbt11a.Canvas2ImagePlugin to package.json
norman@norman-ThinkPad:/development/cordova/tests/android29$ npm install && cordova prepare
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
audited 151 packages in 2.221s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
norman@norman-ThinkPad:/development/cordova/tests/android29$ rm -rf node_modules/
norman@norman-ThinkPad:/development/cordova/tests/android29$ npm install && cordova prepare
npm WARN [email protected] No repository field.
added 402 packages from 282 contributors and audited 151 packages in 7.15s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
I'm using Node 12.15.0 & NPM 6.13.4.
Are you able to provide a sample minimal reproduction app?
from cordova-fetch.
rm -r platforms plugins
before exec "cordova prepare"
no need "rm -rf node_modules/"
from cordova-fetch.
Strange... when I do that, I'm seeing a completely different error...
norman@norman-ThinkPad:/development/cordova/tests/android29$ npm install && cordova prepare
npm WARN [email protected] No repository field.
added 56 packages from 39 contributors and audited 68 packages in 4.177s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
Discovered platform "[email protected]" in config.xml or package.json. Adding it to the project
Using cordova-fetch for [email protected]
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.breautek.api29
Name: HelloCordova
Activity: MainActivity
Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project
Installing "cordova-plugin-whitelist" for android
Discovered saved plugin "org.wbt11a.Canvas2ImagePlugin". Adding it to the project
Failed to restore plugin "org.wbt11a.Canvas2ImagePlugin" from config.xml. You might need to try adding it again. Error: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 'org.wbt11a.Canvas2ImagePlugin' is not in the npm registry.
npm ERR! 404 name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 'org.wbt11a.Canvas2ImagePlugin@latest' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/norman/.npm/_logs/2020-04-13T13_29_53_098Z-debug.log
For me it looks like it's attempting to install by name (so for me I think it is determining the package name properly), but then it fails because it's not an actual NPM package because well, it should be installing from git... not from the NPM repository.
The relevant parts of my package.json
file looks like:
"dependencies": {
"canvas2imageplugin": "git+https://github.com/wbt11a/Canvas2ImagePlugin.git#6195584c2b",
"cordova-android": "8.1.0"
},
"devDependencies": {
"cordova-plugin-whitelist": "^1.3.4"
},
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"org.wbt11a.Canvas2ImagePlugin": {}
},
"platforms": [
"android"
]
}
from cordova-fetch.
@breautek It loos like cordova is executing npm install org.wbt11a.Canvas2ImagePlugin. But this plugin should has been download by npm install. This step is unnecessary.
To fix this question above,use
"dependencies": {
"org.wbt11a.Canvas2ImagePlugin": "git+https://github.com/wbt11a/Canvas2ImagePlugin.git#6195584c2b"
},
from cordova-fetch.
@liuxiaoy I am 90% sure that the weird Error that @breautek (and myself) observed when trying to prepare a project with the plugin, stems from the fact that the ID in the plugin.xml
(org.wbt11a.Canvas2ImagePlugin
) differs from the name
in package.json
(canvas2imageplugin
). I don't know if we support this, but I think we should not.
Anyway, this does not seem to be what this issue is about. You write
the plugin has been download when npm install
no need to download it when cordova prepare
Unfortunately, the package caching done by cordova-fetch
only works for packages referenced by name and version. cordova-fetch
will always download a package when it is given an URL. That is because we cannot translate an URL into a package name to check if we already have the package installed.
If I understood you correctly, I would say everything works as intended. Thus I am closing this issue. If you feel that I misunderstood the issue, please provide additional detail and clear step by step instructions to reproduce your issue.
from cordova-fetch.
@raphinesse Yes, my problem is
“cordova-fetch will always download a package when it is given an URL”.
So "cordova plugin add [email protected]" differs from "cordova plugin add https://github.com/apache/cordova-plugin-camera.git#2.0.0". Maybe it would be better to show this difference On the official guide website.
from cordova-fetch.
@raphinesse Or Maybe we can translate an URL into a package name by the package installed.I'll have a try.
from cordova-fetch.
Related Issues (20)
- cordova cannot add plugins from git (CordovaError: Error: An unknown git error occurred) HOT 15
- coho audit-license-headers issues in cordova-fetch HOT 4
- cordova-fetch patch release August 2018 HOT 1
- Incorrect module ID in case of certain URL patterns HOT 3
- Support node recursive module resolution algorithm HOT 2
- Detect which package manager to invoke HOT 5
- How to handle `save: true` when requested package is already installed HOT 5
- cordova-fetch is much slower at prepare HOT 26
- Private repository and UNMET DEPENDENCY HOT 3
- Install a cordova plugin by tagged version from a custom git repo fails HOT 2
- Adding Cordova plugins is much slower HOT 1
- Too slow donwloading/installing plugins HOT 1
- Fails to get the installed target package name HOT 1
- Save platforms and plugins to devDependencies HOT 5
- cordova-fetch cannot install plugins from git repos with npm 3 if project has unmet peer dependencies HOT 9
- CordovaError: Could not determine package name from output HOT 9
- [email protected] -> [email protected] breaks plugin installs using git repos or local directories HOT 10
- cordova-android referencing git repo is changed to npm package version when performing a release build HOT 7
- cordova prepare : failed to fetch plugins with github spec with npm@7 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-fetch.