Error: failed to resolve @ angular / core module

I am trying to start an angular 4 application, but I keep getting this error

ERROR in Could not resolve module @angular/core 

There are no other errors. There are no dependency errors. @ angular / core exists in the node_modules folder. I tried with the installation of @ angular / cli and without, but did not affect this error. I am not sure how to solve this. This happens on my amazon ec2 machine, but not on my local Mac machine. The versions of the libraries are the same.

Any help would be appreciated. Thanks.

+7
source share
1 answer

If anyone else encounters such an issue-

Your package.json may be corrupted. Follow these steps:

  1. Delete the node_module folder.
  2. Clear / clear cache. To clear the cache, run the following command.

    npm cache clean --force

  3. Reinstall the angular / core library (specific version of your application).

    npm i @angular/core

  4. Run npm install again
0
source

Source: https://habr.com/ru/post/1273263/


All Articles