cordova - 将本机科尔多瓦插件添加到科尔多瓦项目时出现科尔多瓦错误
问题描述
首先我初始化一个cordova项目,如下所示:
cordova create hello com.example.hello hello
cordova platform add android@7.1.0
然后我执行cordova plugin add来安装一个本地的cordova插件,然后它发生如下:
JackRodeMacBook-Pro:hello jack$ cordova plugin add ~/Documents/work-flux/cordova-plugin/com-flux-location
(node:21287) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch plugin /Users/jack/Documents/work-flux/cordova-plugin/com-flux-location via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "../../work-flux/cordova-plugin/com-flux-location" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jack/.npm/_logs/2018-07-10T10_17_06_259Z-debug.log
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:173:37
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:864:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:890:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:808:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:21287) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21287) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我检查了本机插件目录,它包含 package.json 文件。我检查了网络连接,它也很好。
我无法解决。任何人都可以帮助我吗?
解决方案
推荐阅读
- android - 如何从 EditActivity 中删除房间条目?
- amazon-web-services - AWS ElastiCache Redis-如何在集群重启时使用最近的每日备份(只有 1 个节点,没有多可用区)
- css - 从 Typescript Angular 获取 CSS 参数
- javascript - 如何使用 jquery 在 div 中显示多选值?
- android - 用于关机的 HDMI CEC 命令在 Android 上不起作用
- c# - c# 以 lambda 作为成员的结构的初始化
- django - Django 在管理字段中将用户显示为用户全名
- php - php - 从 url 读取 json 数据并保存到变量
- javascript - 如何在 p5 JS 中正确旋转自定义形状并在画布周围移动而不改变其角度?
- mysql - Mysql 崩溃并且无法在 xampp 中启动