【发布时间】:2018-04-04 15:23:05
【问题描述】:
我尝试让 Cordova 通过 localhost 而不是 iOS (11.3) 的 file:// 为我的应用程序提供服务,但无法找到最新的插件来执行此操作。
我在 5 月的 config.xml 文件中尝试了 https://github.com/apache/cordova-plugin-wkwebview-engine 和 <content src="http://localhost/index.html" />。
我尝试了 Cordova-httpd,但它似乎被废弃了一年,当我尝试安装它时,这就是我得到的:
(node:4165) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch plugin https://github.com/floatinghotpot/cordova-httpd.git 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 ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: git+https://github.com/floatinghotpot/cordova-httpd.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/gomoon/.npm/_logs/2018-04-04T14_48_24_009Z-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:150:11)
(node:4165) 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:4165) [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.
所以任何插件或提示都会让我对此感到困惑。
【问题讨论】:
标签: cordova http localhost cordova-plugins