Cord / Ion Build Error (sometimes): no required environment required

I just started doing Cordova / Ionic to make Android / iOS applications with HTML5 / js, and so far I have sometimes used sample / tutorial applications, but not every time.

I am working on Windows and am currently trying to create my own Android projects.

After the pair’s attempt, I can no longer create my applications, even completely “empty” template applications, which I did not change at all. I tried to create applications through Cordova

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

or 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 

Yes, I have an Android SDK and everything is installed. The strange thing is: when I restart the computer and immediately try it, it works without problems , and I can even emulate / run the application. After several attempts, editing the source code, etc. (I'm not quite sure what causes it), it stops working, and I can no longer create a newly created project.

What's happening? Why does it work right after reboot, but stops working for some random reason?

+8
android cordova ionic-framework ionic
source share
3 answers

Copy and paste this into your environment variable path:

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

Then open Android Studio or Eclipse and rebuild some project into the environment and try to build a Cordova project. Hope this helps. This solved the problem for me.

+3
source share

I solved this problem with the correct version of the build tools (not only for the SDK platform).

If Ion installs the target platform for android-21 (see the console log when adding the platform), also install the 21.xx build tools

+1
source share

I ran into the same problem, but fixed the problem using the installed Android5.0.1 (Api21) via sdk manager.

+1
source share

All Articles