angular-cli: @angular/compiler-cli package was not properly installed; cannot find module @angular/compiler
Repro steps.
ng serve
The log given by the failure.
\The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler'
Error: The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler'
at Object.<anonymous> (C:\Users\praha\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\index.js:14:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\praha\AppData\Roaming\npm\node_modules\@angular\cli\tasks\eject.js:10:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
Desired functionality.
Start server
Mention any other details that might be useful.
- tried uninstalling angular package and reinstalling it
- running node version 6.11
- it says typescript is required, but doesn’t install it
- on meeting dependencies separately also, it doesn’t download @angular/compiler
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 41 (2 by maintainers)
Fixed by https://github.com/angular/angular-cli/pull/7033.
We had a bug where
ng new
didn’t wait for the packages to install. Newer versions don’t suffer from this. Removingnode_modules
and runningnpm install
should clear it.first : npm install -g @angular/cli 2 : ng new “your project name” 3 : ng serve : erro >>> do not wrray 4 : npm install @angular/compiler-cli 5 : npm install typescript 6 : npm install @angular/cli
it is work !!
@moezkorkmaz you’re experiencing something different. This issue was about
@angular/compiler-cli
not being in installed, but yours is about@angular/cli
not being in the dependencies. Please open a new issue for yours.The biggest mistake which people do, is that they are not in the project folder , ng serve in that case fails, because it fails to find angular project. So make sure you are in right folder
To resolve the issue, you need to navigate to the correct folder. eg: cd sampleapplication
I had a similar issue: when I ran
ng-serve
I got the same error that informed me that angular cli is not properly installed. My issue was that the project’sdevDependencies
weren’t installing. I had the globalNODE_ENV
variable set toproduction
from a different project, which forces npm to ignoredevDependencies
when installing.After changing that variable’s value and running
npm i
, everything is working as expected. Hope this helps anyone else!EDIT: Resolved the issue by updating the
@angular/cli
to 1.2.6 and recreating the project from scratch.Had this same issue. Deleted
/node_modules
and re-rannpm install
with no success. Any other ideas?Node Version: 8.1.2 CLI version: 1.2.1 NPM Version: 5.0.3
I had also similar issue, I have followed the steps First, npm install -g @angular/cli create new project with ng new hero-app After the go inside the project folder and run server ng serve and open browser and run http://localhost:4200
This is work for me… Hope same thing work for you as well
I just changed to “@angular/compiler-cli”: “^4.3.2” from “@angular/compiler-cli”: “^4.0.0” in devDependencies in package.json file.
It worked for me
I experience the same problem.
Executing
npm install --save-dev @angular/cli@latest
did not help.You just need to reinstall the installation process
npm install -g @angular/cli
ng new my-app
ng serve
It
s works for me !`If you’re still facing this issue, do the following (inside the project folder):
node_modules
dirpackage-lock.json
npm install
npm link
Hope it helps
I was getting the same error and was able to solve it by reinstalling angular-cli locally.
npm i @angular/cli
This is why 3 years ago I migrated mostly to react… (Happened to me today)
I managed to get mine fixed by first running the
npm install "whatever-it-says-i-am-missing"
and then i rannpm update
and i got a new hint from cli to change my environment configurations.I was also facing the same problem, But after restarting my system it all working fine.
Hi there. I follow asfo steps and that work for me. Now I am going to build great ng app. 😃
Restarting did solve my issue