Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error executing 010_add_platform_class.js using VS Tools for Apache Cordova

I have imported an existing Ionic app into VS 2015 Update 1. I'm using the latest Tools for Apache Cordova Update 7. When I build the app, I'm getting the errors below when it tries to execute the hooks\after_prepare\010_add_platform_class.js file. If I remove the file, VS will build and execute the app fine. Is this a bug in TACO or am I doing something wrong?

Executing "after_prepare"  hook for all plugins.
1>  Running command: "C:\Program Files (x86)\nodejs\node.exe" D:\SampleApp\hooks\after_prepare\010_add_platform_class.js D:\SampleApp
1>MSBUILD : cordova-build error : net.js:633
1>  net.js:633
1>MSBUILD : cordova-build error :  throw new TypeError('invalid data');
1>      throw new TypeError('invalid data');
1>MSBUILD : cordova-build error :  ^
1>            ^
1>MSBUILD : cordova-build error : TypeError: invalid data
1>  TypeError invalid data
1>MSBUILD : cordova-build error :  at Socket.write (net.js:633:11)
1>      at Socket.write (net.js:633:11)
1>MSBUILD : cordova-build error :  at Object.<anonymous> (D:\SampleApp\hooks\after_prepare\010_add_platform_class.js:90:22)
1>      at Object.<anonymous> (D:\SampleApp\hooks\after_prepare\010_add_platform_class.js:90:22)
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)
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 Function.Module.runMain (module.js:501:10)
1>      at Function.Module.runMain (module.js:501:10)
1>MSBUILD : cordova-build error :  at startup (node.js:129:16)
1>      at startup (node.js:129:16)
1>MSBUILD : cordova-build error :  at node.js:814:3
1>      at node.js:814:3
1>  Command finished with error code 1: C:\Program Files (x86)\nodejs\node.exe D:\SampleApp\hooks\after_prepare\010_add_platform_class.js,D:\SampleApp
1>MSBUILD : cordova-build error : Error: Hook failed with error code 1: D:\SampleApp\hooks\after_prepare\010_add_platform_class.js
1>  Error Hook failed with error code 1: D:\SampleApp\hooks\after_prepare\010_add_platform_class.js
like image 446
Ionian316 Avatar asked May 31 '26 19:05

Ionian316


1 Answers

This can happen if you're building in a project where your files are locked as read-only (for example, when using TFS source control). Upon build, there is a script used by Ionic to modify the home page of your app to add a CSS class that identifies your target platform. If your home page file (e.g. index.html) is marked as read only, try clearing that setting and build again.

like image 168
Jordan Matthiesen Avatar answered Jun 02 '26 19:06

Jordan Matthiesen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!