我是 Cordova 新手,我尝试向我的项目添加一些包。我需要从 GitHub 安装一个特定的包,所以我尝试使用以下方法:
cordova plugin add https://github.com/acipher/pos
但它给了我以下内容:
Failed to fetch plugin https://github.com/acipher/pos via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: ENOENT: no such file or directory, open 'C:\Users\<USERNAME>\AppData\Local\npm-cache\_cacache\tmp\git-clonepy4F6q\package.json'
然后我尝试从 npm 和 GitHub 添加其他一些内容,它们都有效,这意味着包本身肯定有问题。由于我是科尔多瓦新手,我真的不能说为什么它不起作用。
我使用的版本:
Cordova: 12.0.0 ([email protected])
Node.js: v17.9.1
Npm: 8.11.0
只需在 config.xml 中声明它即可,例如
<plugin name="cordova-plugin-someplugin" spec="git+https://github.com/something/cordova-plugin-someplugin" />
只需确保替换插件名称和插件存储库网址