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

我是研究僧i 提交于 2019-12-12 13:27:08

问题


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

回答1:


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.




回答2:


are you deploying to Ripple when you get this error? Does this happen when you build a blank project to local machine? Try deleting the platforms folder and rebuilding.



来源:https://stackoverflow.com/questions/36269131/error-executing-010-add-platform-class-js-using-vs-tools-for-apache-cordova

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!