在全新的cordova安装中,出现以下错误:
$ cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\myuser\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
studio
The system cannot find the path specified.
(node:17492) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\myuser\Code\test\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:17492) 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:17492) [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.
还有其他人遇到此问题吗?我尝试将环境变量重新添加到Windows 10系统中,但没有成功。
版本:
npm 6.1.0
节点8.11.2
科尔多瓦8.0.0
操作系统:Windows 10
答案 0 :(得分:0)
万一其他人最终遇到此问题,这是我为解决此问题所做的事情。
我最初是通过Intellij Idea安装的,它遇到了bug atm并导致获取了所有android组件的困扰...我相信这是导致某些文件在下载时被跳过的问题。 如果您碰巧也使用Intellij Idea,请卸载intellij 2018并获取最新的2017版本,但不要通过该软件安装任何组件。让android studio这样做,然后使用Intellij进行编辑。
最后,某些安装还缺少一些文件,仍然导致cordova run android命令失败。为了解决这个问题,我刚刚创建了一个新项目,然后将其移到文件上。