I run the command npm install -g @angular/cli and after i tried to run my app it says, Cannot find module \'@angular/compiler\' in the terminal. How can i install the compil
Just to add to this. You will get this error too, when you are running ng serve
not from within your project folder. So always make sure your bash runs from your project folder.
Try to delete that "angular/cli": "1.0.0-beta.28.3",
in the devDependencies
it is useless , and add instead of it "@angular/compiler-cli": "^2.3.1",
(since it is the current version, else add it by npm i --save-dev @angular/compiler-cli
), then in your root app folder run those commands:
rm -r node_modules
(or delete your node_modules
folder manually)npm cache clean
(npm > v5 add --force
so: npm cache clean --force
)npm install
In my case this was required:
npm install @angular/compiler --save
npm install @angular/cli --save-dev
Try this
npm uninstall angular-cli
npm install @angular/cli --save-dev
Uninstall the Angular CLI and install the latest version of it.
npm uninstall angular-cli
npm install --save-dev @angular/cli@latest
I just run npm install
and then ok.