ng服务不会自动检测文件更改 [英] ng serve not detecting file changes automatically
本文介绍了ng服务不会自动检测文件更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每次对源文件进行任何更改时,我都需要运行ng serve
.控制台中没有错误.
I need to run ng serve
every time when any changes made to the source files.I have no error in the console.
Angular CLI: 1.6.2
Node: 8.9.1
OS: linux ia32
Angular: 5.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.0.2-c3d7cd9
@angular/cli: 1.6.2
@angular/material: 5.0.3-e20d8f0
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.2
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0
推荐答案
在大多数情况下,如果目录没有足够的权限,ng serve
或ng build --watch
都不起作用.
Most of the times in Linux, ng serve
or ng build --watch
doesn't work if the directory doesn't have sufficient permissions.
解决方案是提供必要的权限或使用sudo
.
The solution is either to provide the necessary permissions or to use sudo
instead.
更新
watch标志是多余的,因为它是默认选项.感谢@Zaphoid指出了错误.
watch flag in ng serve
is actually redundant as it is the default option. Credit to @Zaphoid for pointing out the mistake.
这篇关于ng服务不会自动检测文件更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文