简体   繁体   English

在服务节点ionic2之前运行“监视”

[英]run 'watch' before serve- node ionic2

I am working with ionic 2. And I don't know why when I'm trying to run 'ionic serve', it answer with the next messeges: 我正在使用离子2。而且,我不知道为什么当我尝试运行“离子发球机”时,它会在下一个消息中回答:

WARN: ionic.config.js has been deprecated, you can remove it. 警告:ionic.config.js已被弃用,您可以将其删除。 WARN: No 'serve:before' gulp task found! 警告:没有找到“ serve:before” gulp任务! Your gulpfile contains a 'watch' task already! 您的gulpfile已经包含一个“监视”任务! Add: 加:

gulp.task('serve:before', ['watch']);

to your gulpfile to have Ionic CLI run 'watch' before serve. 到您的gulpfile,以便在投放之前让Ionic CLI运行“监视”功能。

WARN: ionic.config.js has been deprecated, you can remove it. 警告:ionic.config.js已被弃用,您可以将其删除。

In the gulpfile.js I add that line and it works, but when I change some html file it don't update. 在gulpfile.js中,我添加了这一行,它可以工作,但是当我更改一些html文件时,它不会更新。 I have to stop serve. 我必须停止服务。 And run the command again. 并再次运行命令。 PD: I have alredy install all dependencies with npm install Thanks PD:我已经使用npm install安装了所有依赖项

Recently Ionic updated their CLI tool (to beta.21). 最近,Ionic将其CLI工具更新为beta.21。 They have obviously made some changes in the gulp file which is being generated by their newly updated CLI. 他们显然已经对新近更新的CLI生成的gulp文件进行了一些更改。 The project you are trying to run was created using an older version of CLI (probably beta.19). 您尝试运行的项目是使用较旧版本的CLI(可能是beta.19)创建的。 That's why you are getting that warning. 这就是为什么您收到该警告。 Regarding the 'ionic.config.js has been deprecated' line, that file is simply a checkpoint to see whether you are using the latest version of Ionic CLI. 关于“ ionic.config.js已弃用”这一行,该文件只是检查您是否正在使用最新版本的Ionic CLI的检查点。

There is a quick fix (which I did). 有一个快速修复(我做了)。

1) Create a new ionic app (possibly using the same template as the one you are trying to run ie, blank or sidemenu or tabs). 1)创建一个新的离子应用程序(可能使用与尝试运行的模板相同的模板,即空白或侧面菜单或选项卡)。

2) Copy the contents of the app directory of the project which you are trying to run to the app directory of the newly generated project. 2)将您要运行的项目的app目录的内容复制到新生成的项目的app目录中。

(I don't know whether this is the right method, but this will work.) (我不知道这是否是正确的方法,但这会起作用。)

Hope this helps you. 希望这对您有所帮助。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM