I'm working an Angular 2 project. Now trying to install Angular CLI within the current project with the following
npm install --save-dev @angular/cli@latest npm install
Problem is when running ng serve
I receive error
The "@angular/compiler-cli" package was not properly installed. Error: The "@angular/compiler-cli" package was not properly installed. at Object.<anonymous> (/myng2project/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> (/myng2project/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)
Try navigating to /usr/local/bin and : if check if the file named ng is present over there, if yes then rm -r ng and it will remove that file. Then you can try sudo npm i -g @angular/cli@latest And it will be a successful install.
The Angular latest Official stable version is Angular v13. 2.5, which is released on 2nd March 2022.
The Angular Compiler (which we call ngc ) is the tool used to compile Angular applications and libraries. ngc is built on the TypeScript compiler (called tsc ) and extends the process of compiling TypeScript code to add additional code generation related to Angular's capabilities.
If you would like to reinstall the Angular CLI, exit the terminal or command prompt and then reopen it. Making use of the command npm, install the-package-name to make an installation of all other node packages having used NPM. It will be placed in the node_modules directory after that.
I had the same problem. I resolved it following the "Updating Angular CLI" process in the npm @angular/cli page, that is:
rm -rf node_modules dist npm uninstall -g @angular/cli npm cache clean
npm install -g @angular/cli@latest npm install ng serve
This worked for me.
I've tried everything in these answers and the only thing that worked for me was the following:
Step 1: npm install -g @angular/cli@latest
Step 2: ng new name-of-project (ignore if project already created)
Step 3: cd name-of-project (ignore if project already created)
Step 4: npm install @angular/cli --save-dev
Step 5: npm install @angular/compiler-cli --save-dev
Step 6: ng serve
Tested these steps in two different environments
Inside of project folder, type "npm install" and wait the installation finishes, this fix works fine for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With