Failed to fetch plugin https://git.xxx-plugin.git 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 ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: https://git.xxx-plugin.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx/.npm/_logs/2020-10-15T03_24_04_879Z-debug.log
现象:在cordova项目重新添加自定义plugin的时候报错,我使用的命令是:cordova plugin add https://git.xxxx/xxx-cordova-plugin.git
原因分析:
1.可能是我这个插件部署在公司内网,所以需要在内网才能安装插件;
2.插件版本被固定了,#之后的内容,貌似固定了版本的签名
要删除
3.删除原有插件的文件夹
4.添加命令可能错了:
cordova plugin add https://git.xxxx/xxx-cordova-plugin.git 错误
cordova plugin add git+https://git.xxxx/xxx-cordova-plugin.git 正确
至此重新安装修改后的插件成功。
本文讲述了在Cordova项目中遇到的插件安装错误,原因可能是内网路径问题或缺少package.json。通过排查和调整,作者分享了正确添加git+协议的插件URL,并提供了解决步骤,确保了插件的顺利安装。
1755

被折叠的 条评论
为什么被折叠?



