Search code examples
javascriptandroidcordovavisual-studio-2015visual-studio-cordova

Cordova build Error for Android So i can't build my solution


I got a lot of Errors like this, so i can't build my project! I'm using visual studio 2015. What is the meaning of this errors? And How could i solve this problems?

enter image description here

1>  ------ Version from source package.json: 1.0.42
1>  ------ Package already installed globally at correct version.
1>  ------ Cordova tools 8.0.0 already installed.
1>MSBUILD : cordova-build error : C:\Users\Anna\AppData\Roaming\npm\node_modules\cordova\node_modules\json-parse-better-errors\index.js:9
1>  C:\Users\Anna\AppData\Roaming\npm\node_modules\cordova\node_modules\json-parse-better-errors\index.js:9
1>MSBUILD : cordova-build error :  const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i)
1>      const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i)
1>MSBUILD : cordova-build error :  ^^^^^
1>      ^^^^^
1>MSBUILD : cordova-build error : SyntaxError: Use of const in strict mode.
1>  SyntaxError Use of const in strict mode.
1>MSBUILD : cordova-build error :  at exports.runInThisContext (vm.js:73:16)
1>      at exports.runInThisContext (vm.js:73:16)
1>MSBUILD : cordova-build error :  at Module._compile (module.js:443:25)
1>      at Module._compile (module.js:443:25)
1>MSBUILD : cordova-build error :  at Object.Module._extensions..js (module.js:478:10)
1>      at Object.Module._extensions..js (module.js:478:10)
1>MSBUILD : cordova-build error :  at Module.load (module.js:355:32)
1>      at Module.load (module.js:355:32)
1>MSBUILD : cordova-build error :  at Function.Module._load (module.js:310:12)
1>      at Function.Module._load (module.js:310:12)
1>MSBUILD : cordova-build error :  at Module.require (module.js:365:17)
1>      at Module.require (module.js:365:17)
1>MSBUILD : cordova-build error :  at require (module.js:384:17)
1>      at require (module.js:384:17)
1>MSBUILD : cordova-build error :  at Object.<anonymous> (C:\Users\Anna\AppData\Roaming\npm\node_modules\cordova\node_modules\read-package-json\read-json.js:12:16)
1>      at Object.<anonymous> (C:\Users\Anna\AppData\Roaming\npm\node_modules\cordova\node_modules\read-package-json\read-json.js:12:16)
1>MSBUILD : cordova-build error :  at Module._compile (module.js:460:26)
1>      at Module._compile (module.js:460:26)
1>MSBUILD : cordova-build error :  at Object.Module._extensions..js (module.js:478:10)
1>      at Object.Module._extensions..js (module.js:478:10)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

Solution

  • This problem might be in regedit setting

    OR

    You are trying to move program file/android/folders to appdata/android/folders.

    I fixed this problem by reinstall android studio and reseting the system path related to cordova.