VS2013 Кордова приложения Выход кода 1

Обновить

April 2019

Просмотры

1.4k раз

1

Я работаю на приложении Cordova с помощью VS2013 инструментов для Кордовы и машинописи.

Я недавно обновил узел, а затем я начал получать эту ошибку

Building platform: android (TaskId:22)
1>  Debug (TaskId:22)
1>  ------ Build configuration options: --debug (TaskId:22)
1>  Running command: E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\build.bat --debug   (TaskId:22)
1>  E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\node_modules\q\q.js:126 (TaskId:22)
1>                      throw e; (TaskId:22)
1>                            ^ (TaskId:22)
1>  TypeError: Cannot read property 'prepEnv' of undefined (TaskId:22)
1>      at Object.module.exports.run (E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\lib\build.js:326:19) (TaskId:22)
1>      at E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\build:36:22 (TaskId:22)
1>      at _fulfilled (E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\node_modules\q\q.js:798:54) (TaskId:22)
1>      at self.promiseDispatch.done (E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\node_modules\q\q.js:827:30) (TaskId:22)
1>      at Promise.promise.promiseDispatch (E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\node_modules\q\q.js:760:13) (TaskId:22)
1>      at E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\node_modules\q\q.js:574:44 (TaskId:22)
1>      at flush (E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\node_modules\q\q.js:108:17) (TaskId:22)
1>      at process._tickCallback (node.js:355:11) (TaskId:22)
1>  Command finished with error code 1: E:\Apps\myapp\myapp\bld\Debug\platforms\android\cordova\build.bat --debug,, (TaskId:22)

3 ответы

0

I have exact same error but in 2015 CTP 6. I have correct JAVA_HOME. Here is my env.

  • angularjs 1.3.14
  • jQuery 1.8.0
  • JAVA_HOME = C:\Program Files\Java\jdk1.8.0_40
  • ADT_HOME = C:\Users\MyUserName\AppData\Local\Android\android-sdk
  • ANT_HOME =C:\apache-ant-1.9.4-bin\apache-ant-1.9.4
  • Node.js verion 0.12.2

Everything works fine in Android and Ripple. I get this error while compiling for device. Device is connected.

....\bld\Debug\platforms\android\cordova\node_modules\q\q.js:126 (TaskId:11)

                throw e; (TaskId:11)
                       ^ (TaskId:11)

TypeError: Cannot read property 'prepEnv' of undefined (TaskId:11)

  at process._tickCallback (node.js:355:11) (TaskId:11)
0

I had the same problem. I remove node.js and reinstalled it. And I had to set my system variable for JAVA_HOME and JAVA like in this answer cordova platform add android get an error in JAVA_HOME (without (x86) despite it is in C:\Program Files (x86)).

1

Looks like this is a known issue, adding a space to the project's path fixes it:

https://connect.microsoft.com/VisualStudio/feedback/details/1192337/tools-for-apache-cordova-ctp-3-1-cant-build-for-android

Note this happens only when targeting Android on CTP3.1.