使用VS Tools for Apache Cordova执行010_add_platform_class.js时出错 [英] Error executing 010_add_platform_class.js using VS Tools for Apache Cordova

查看:190
本文介绍了使用VS Tools for Apache Cordova执行010_add_platform_class.js时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将现有的Ionic应用程序导入到VS 2015 Update 1.我正在使用最新的Apache Cordova Update 7工具。当我构建应用程序时,我在尝试执行 hooks\after_prepare\010_add_platform_class.js 文件。如果我删除该文件,VS将构建并执行该应用程序。这是TACO中的错误还是我做错了什么?

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


推荐答案

如果您在一个项目中构建文件被锁定为只读(例如,使用TFS源代码控制时),则会发生这种情况。在构建时,Ionic使用一个脚本来修改应用程序的主页,以添加标识您的目标平台的CSS类。如果您的主页文件(例如index.html)被标记为只读,请尝试清除该设置并重新构建。

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.

这篇关于使用VS Tools for Apache Cordova执行010_add_platform_class.js时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆