Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Cordova build fails

When I build any android app with Cordova, it fails with

TypeError: Cannot read property 'prepEnv' of undefined.

I've done all the troubleshooting and checked environment variables (As per MS documentation)

What I found is that if I call bld\Debug\platforms\android\cordova\build --ant --debug from my project folder, the build works.

But when I call "C:\Users\<user>\AppData\Roaming\npm\\node_modules\vs-mda\vs-cli.cmd" build --platform Android --configuration Debug --projectDir . --rojectName Gappy --npmInstallDir C:\Users\<user>\AppData\Roaming\npm --language en-US --buildTarget AndroidDevice, the build fails.

One of the steps of the second method, is to call the first batch file.

This happens with VS2013 and VS2015. 64 and 32 bit versions of Node.JS

Any help / ideas?

like image 794
Dawid Mostert Avatar asked Mar 13 '15 09:03

Dawid Mostert


1 Answers

I noticed that the build file is called differnetly depending on whether the path to the solution contains spaces:

1> ------ Build configuration options: 1> Running command: C:\Projects\Mobile\AppSolutionName\AppSolutionName\bld\Debug\platforms\android\cordova\build.bat --debug --ant

1> ------ Build configuration options: --debug 1> Running command: cmd "/s /c ""C:\Projects\Mobile Apps\AppSolutionName\AppSolutionName\bld\Debug\platforms\android\cordova\build.bat" --debug --ant ""

It works if there are spaces and it fails with "TypeError: Cannot read property 'prepEnv' of undefined" if there are none. I don't know if this is specific to my environment but with the spaces in the path I can build now.

like image 55
Florian Fogl Avatar answered Nov 14 '22 23:11

Florian Fogl