Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular: HttpClientModule import error (could not be resolved to an NgModule class)

I had the same problem, I just run the following command and it worked after without any error.

npm cache verify

If it does not, try manually deleting the node_modules folder and reinstalling the modules with npm install.

rm -rf node_modules
npm install

On npm > 6, you can also run npm ci, which also deletes the node_modules folder and reinstall packages after.

Edit As other answers suggested, you may need to restartng serve if the above steps do not work (but they normally do)


just stop ng serve before adding new package, after adding new package restart ng serve. This will solve this issue.


First Stop ng serve and run these commands...

npm cache verify
rm -rf node_modules
npm install

After the installation build & run your project using the commands

ng build
ng serve

It works for me and solve the issue...


First of all youy just need to delete node-modules folder then update the npm by using command

npm i -g npm

Then you need to build your project for maintenance of angulare project which can be done by using command

ng build

then you will be able to serve or host the project by typin g command

ng serve


I resolved this issue by using the following steps

  1. stoped ng serve cmd
  2. ran npm cache verify cmd
  3. started ng serve cmd