android - tutorial - npm install-g ionic cordova

Cordova/Ionic build error(sometimes): don't have required environment (3)

Copy and paste this to your environment variable path:


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.

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.

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

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

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
      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 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?

I have solved this problem by having the correct version of the build tools too (not only the SDK platform).

If ionic sets the platform target to android-21 (see console log when adding the platform), install the build tools 21.x.x also.

Building Sencha Touch app with Cordova - [You may not have the required environment or OS to build this project] error

As suggested here, Cordova / Ionic build error (sometimes): don't have required environment, what to do is Copy and paste this "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\" to the enviroment variables Path.