Angular Cli - Project is not recompiled

0

I am learning to work with Angular 4, on a Mac computer.

Initially I was running ng serve and every time I recorded files from the application the project was automatically compiled and the address link .

However, it stopped working and he could not understand the reason.

Someone could help me to try to solve it and so I can continue with my practices.

Thank you.

I complement the question:

When running ng --version the following appears:

@ angular / cli: 1.3.2 node: 8.1.4 os: darwin x64 @ angular / animations: 4.3.2 @ angular / common: 4.3.2 @ angular / compiler: 4.3.2 @ angular / core: 4.3.2 @ angular / forms: 4.3.2 @ angular / http: 4.3.2 @ angular / platform-browser: 4.3.2 @ angular / platform-browser-dynamic: 4.3.2 @ angular / router: 4.3.2 @ angular / cli: 1.3.2 @ angular / compiler-cli: 4.3.2 @ angular / language-service: 4.3.2

When running ng serve the following appears:

**** NG Live Development Server is listening on localhost: 4200, open your browser on link ** Date: 2017-08-30T17: 21: 15.840Z
Hash: 44aab2e16c88308870fa Time: 15670ms chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered] chunk {main} main.bundle.js, main.bundle.js.map (main) 38.8 kB {vendor} [initial] [rendered] chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 203 kB {inline} [initial] [rendered] chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.3 kB {inline} [initial] [rendered] chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.66 MB [initial] [rendered]

webpack: Compiled successfully. **

By opening the address localhost you can see the project.

However, when changes are made to the project files and recorded, the development server does not update them automatically and displays them in the browser, as you normally should. That is, the server is not listening or updating the changes that are taking place in the project.

So it forces to interrupt the server with Ctrl + C and then rerun ng serve to be able to see the result of the changes made, which makes the development very slow.

    
asked by Javier Vargas 29.08.2017 в 22:46
source

2 answers

0

Make sure you have not modified the npm start script in your package.json since otherwise the node server will not be lifting you.

"scripts": {
  "start": "ng serve"
}

If ok, you can debug the ng serve command with

node --inspect --debug-brk ./node_modules/\@angular/cli/bin/ng serve

Copy the url that I throw to you in the terminal and paste it into your chrome browser. Then you will have to continue the execution of the script in Resume script execution and so you will get details of the error in the terminal from where you executed the debugger

If it does not work, it is recommended to reinstall angular-cli, since without error information it is not possible to give you more help.

Update from the documentation:

npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

In your local project:

rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install

Check the version:

ng --version
    
answered by 30.08.2017 / 17:53
source
0

I also have that same problem, when editing some file of the project this is not recompilated or the page is refreshed.

It occurred to me to run sudo ng serve and so if you recompile. It does not seem to be the solution but it helped me at least, it seems to be a problem with the permissions, since it does not detect the changes in the files and that's why it does not recompile.

    
answered by 11.06.2018 в 17:03