Cordova / Ionic构建错误(有时):没有所需的环境 [英] Cordova / Ionic build error (sometimes): don't have required environment

查看:130
本文介绍了Cordova / Ionic构建错误(有时):没有所需的环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始在Cordova / Ionic上试用HTML5 / js的Android / iOS应用程序,到目前为止,我已经获得了有时可以工作的示例/教程应用程序,但不是每次。

I have just started dabbling in Cordova / Ionic to make Android / iOS apps with HTML5 / js, and so far I have gotten sample / tutorial apps to work sometimes, but not every time.

我在Windows上工作,目前正在尝试为Android构建我的项目。

I am working on Windows and am trying to build my projects for Android for now.

经过几次尝试后,我无法再构建我的应用程序,甚至完全空白模板应用程序,我没有改变。我尝试通过Cordova创建应用

After a couple tries, I am no longer able to build my apps, even completely "blank" template apps that I did not change at all. I tried creating apps via Cordova

cordova create hello com.example.hello HelloWorld
cd hello
cordova build android

或Ionic

ionic start test sidemenu
cd start
ionic build android

在这两种情况下,我得到相同的错误:

In both cases I get the same error:

Running command: C:\Users\nthissen\Dropbox\Mobile\Projects\hello\platforms\andro
id\cordova\build.bat
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn cmd ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
    at child_process.js:1137:20
    at process._tickCallback (node.js:355:11)
ERROR building one of the platforms: Error: C:\Users\nthissen\Dropbox\Mobile\Pro
jects\hello\platforms\android\cordova\build.bat: Command failed with exit code 1

You may not have the required environment or OS to build this project

是的,我有Android SDK和一切安装。奇怪的是:当我重新启动计算机并立即尝试时,它没有问题,我甚至能够模拟/运行应用程序。经过多次尝试,编辑源代码等(我不太确定是什么导致它),它停止工作,我甚至不能再建立一个新创建的项目了。

Yes, I do have the Android SDK and everything installed. The strange thing is: when I restart my computer and try it immediately, it works without problems and I'm even able to emulate / run the app. After a couple more tries, edits to the source code, etc (I am not quite sure what's causing it), it stops working and I cannot even build a newly created project anymore.

发生了什么事?

推荐答案

将其复制并粘贴到您的环境变量中路径:

Copy and paste this to your environment variable path:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32 \WindowsPowerShell\v1.0\

然后打开Android Studio或Eclipse,并重建一些项目进入环境,构建您的Cordova项目。希望它会有所帮助。这解决了我的问题。

Then open Android Studio or Eclipse and make a rebuild to some project into the environment and try to build your Cordova project. Hope it will help. That solved the problem for me.

这篇关于Cordova / Ionic构建错误(有时):没有所需的环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆