首先,我像下面那样初始化一个cordova项目:
cordova create hello com.example.hello hello
cordova platform add android@7.1.0
然后我执行cordova插件添加以安装本机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文件。我检查了网络连接,也很好。
我无法解决。有人可以帮助我吗?