Cordova/Ionic 构建错误(有时):没有所需的环境 [英] Cordova / Ionic build error (sometimes): don't have required environment
问题描述
我刚刚开始涉足 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 start test sidemenu
cd start
ionic build android
在这两种情况下,我都遇到相同的错误:
In both cases I get the same error:
Running command: C:Users
thissenDropboxMobileProjectshelloplatformsandro
idcordovauild.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
thissenDropboxMobilePro
jectshelloplatformsandroidcordovauild.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.
这是怎么回事?为什么它在重新启动后立即工作,但由于看似随机的原因停止工作?
What's going on? Why does it work right after a reboot, but stops working for seemingly random reason?
推荐答案
复制并粘贴到您的环境变量路径:
Copy and paste this to your environment variable path:
%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.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屋!