I need to run ng serveevery time any changes made to the source files. I have no error in the console.
ng serve
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
In most cases, Linux ng serve --watcheither ng build --watchdoes not work if the directory does not have sufficient permissions.
ng serve --watch
ng build --watch
The solution is to either provide the necessary permissions or use instead sudo.
sudo
UPDATE
The watch flag is ng serveactually redundant, as this is the default option. Thanks to @Zaphoid for pointing out the error.
ng serve --poll=2000
Works fine on Linux and Windows
, INotify Watches Linux. , , 512 .
sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p --system
, , .
, :
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
: https://github.com/angular/angular-cli/issues/8313#issuecomment-362728855 https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers
- , , , .
change the amount of watches, ( , ), run this command:
change the amount of watches
run this command
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
inotify , .
dist
sudo ng serve ng serve.
sudo ng serve
, linux. INotify Watches Linux. ,
//When live server not work in linux sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p --system ng serve //You can also do sudo **ng serve**
, Windows ng serve --poll = 2000 .
sudo.
, , . ng serve ng build --watch , , , - ng.
ng
,
Ubuntu, , , :
echo fs.inotify.max_user_watches = 524288 | sudo tee/etc/sysctl.d/40-max-user-watches.conf & sudo sysctl --system
, dist/ root. sudo ng serve , ng serve - .
dist/folder sudo rm -R dist/ , dev server ng serve sudo rm -R dist/.
sudo rm -R dist/
, , index.html, , , . Angular.
index.html
, VS Code. ng serve , : . . , html- HTML- ( HTML <!doctype html>. , HTML HTML HTML.
<!doctype html>
bam, ( ).
, index.html , , , , , , VS Code , , .
Linux Ubuntu , " " VSCode. , VSCode, ng watch. https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
, sudo . , npm root . , , , , sudo root, , ( , vscode atom ). - , / chown.
chown
sudo ng serve - . npm , npm packages sudo.
npm
npm packages
, npm , npm node_modules npm install. ng serve sudo ng serve , .
node_modules
npm install
, https://github.com/angular/angular-cli/issues/8054#issuecomment-336615324
: sudo ng serve , "" . sudo IMO.
INotify (8192), : lsof | grep inotify | wc -l lsof | grep inotify | wc -l lsof | grep inotify | wc -l , , , . , INotify, , .
lsof | grep inotify | wc -l
- VS Code. , , , .
-. , , . / , , , .
.
VS .
SO. fs.inotify.max_user_watches () , ...
"Ng serve --poll = 2000" - , , , ...
: https://github.com/angular/angular-cli/wiki/angular-cli .
de angular.json
"serve": { "builder.... "options": { "browserTarget": "xkcd:build", "poll": 2000 } ...
: D
, ng serve sudo . : sudo ng serve.
. - .
, , . .
I would like to leave my business here, just for reference. In my case, the problem was in system permissions. I used the shared folder inside the virtual machine as a repository. I did not have another message, for example, permission denied or something else. I tried everything and then I just realized that I was using a network drive.
Restarting the server worked for me.
If you are using the WebStorm IDE, use Save All( Ctrl+ s) after making the changes .
Save All
Source: https://habr.com/ru/post/1691730/More articles:Adding y axis label to secondary y axis in matplotlib - pythonWhat are the actual keys / settings for AVAudioRecorder? - dictionaryCannot start mongod.service: Unit mongod.service not found - mongodbPlay Store только для эмулятора Nexus 5/5x - androidAlign secondary ticks of y axis with stripplot on primary x axis - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1691731/angular-2-pass-directives-to-a-custom-component&usg=ALkJrhgUfgUpsFDYODaidvz1vvZjhNFBtgThe Builder interface collapses the vertical representation of the stack horizontally and back after each action - iosSELECT Values from Varray ORACLE SQL - sqlИспользование оператора% in% в столбце data.table - rOracle ojdbc8 12.2.0.1 Forbidden Maven - javaAll Articles