Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Versions of @angular/compiler-cli and typescript could not be determined

Tags:

angular-cli

I have installed Angular/cli and then try to run command ng serve then below error is throwing. I have tried lot of thing like uninstall angular/cli, npm cache clean, etc

Versions of @angular/compiler-cli and typescript could not be determined. The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in devDependencies, then delete node_modules and package-lock.json (if you have one) and run npm install again.

like image 675
Harshad Kumbhar Avatar asked Nov 08 '17 17:11

Harshad Kumbhar


3 Answers

This may be a problem in not implicitly running devDependencies.

Try running them implicitly with the command below.

npm install --dev
like image 137
Cixtian Trybe Avatar answered Oct 29 '22 19:10

Cixtian Trybe


Generic way out to escape this issue

  1. Create a new project

    ng new angular-seed

  2. Copy all the default dependencies and dev-dependenices from package.json to your current project in use (angular, typescript, etc...)

enter image description here

  1. Then remove node_modules and run install npm packages of your current project, or whatever method you use to reubild

    rm -fr node_modules npm install

note: if this doesn't get you the latest version, then you may have global tools installed in roaming data (in window explored browser type %appdata%, and navigate to npm to observe)

like image 5
Iancovici Avatar answered Oct 29 '22 17:10

Iancovici


1. Open the command prompt in your project folder.

2. Run the command.

 npm install --only=dev
like image 3
Deepu Reghunath Avatar answered Oct 29 '22 19:10

Deepu Reghunath