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

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

ng 1.5.0 node 8.9.0 npm 5.5.1 yarn 1.3.2 visual studio code 1.17.2

Repro steps.

run ng serve or ng serve -aot

The log given by the failure.

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.

Desired functionality.

Mention any other details that might be useful.

here my package.json

{
    "name": "migate",
    "version": "0.1.0",
    "license": "MIT",
    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "^5.0.0",
        "@angular/common": "^5.0.0",
        "@angular/core": "^5.0.0",
        "@angular/forms": "^5.0.0",
        "@angular/platform-browser": "^5.0.0",
        "@angular/platform-browser-dynamic": "^5.0.0",
        "@angular/router": "^5.0.0",
        "bootstrap": "^4.0.0-beta.2",
        "core-js": "^2.5.1",
        "global": "^4.3.2",
        "jquery": "^3.2.1",
        "json-typescript-mapper": "^1.1.3",
        "popper.js": "^1.12.6",
        "roboto-fontface": "^0.8.0",
        "rxjs": "^5.5.2",
        "typescript-string-operations-ng4": "^0.1.0",
        "zone.js": "^0.8.18"
    },
    "devDependencies": {
        "@angular/cli": "^1.5.0",
        "@angular/compiler": "^5.0.0",
        "@angular/compiler-cli": "^5.0.0",
        "@angular/language-service": "^5.0.0",
        "@types/jasmine": "~2.6.2",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.0.47",
        "codelyzer": "~4.0.0",
        "jasmine-core": "~2.8.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~1.7.1",
        "karma-chrome-launcher": "~2.2.0",
        "karma-cli": "~1.0.1",
        "karma-coverage-istanbul-reporter": "^1.3.0",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "protractor": "~5.2.0",
        "ts-node": "~3.3.0",
        "tslint": "~5.8.0",
        "typescript": "~2.4.0",
        "webpack": "^3.8.1",
        "webpack-sources": "^1.0.1"
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 13
  • Comments: 42 (3 by maintainers)

Most upvoted comments

I solved The Issue after 23hrs of research and continues trails

Sollution:

Add the three { “@angular/cli”: “1.5.2”, “@angular/compiler-cli”: “^5.0.0”, “typescript”: “^2.4.2” } in “dependencies” too so these will be installed without error I repeat again make sure the above three are available in “dependencies” and Devdependencies too…

It will work for sure… If you have any doubts mail me or call me

Thank you, everyone…

I don’t have NODE_ENV=production and have the same error

+1 I am also having same problem and tried different things but nothing worked

The same issue was for me too.

...
 "@angular/cli": "1.5.2",
 "@angular/compiler": "^5.0.0",
 "@angular/compiler-cli": "^5.0.0",
 "typescript": "^2.6.1"
...

Works fine in dependencies and devDep.

Do you have environment variable NODE_ENV=production like I had? Clear this value, delete folder node_modules and file package-lock.json, rerun npm install, reassign the NODE_ENV and you should be ok. See also npm issues

I managed to solve my own problem, and have deployed to heroku. I put them two, @angular/compiler-cli and typescript together with @angular/cli in the dependencies. Don’t know if this is the solution, @angular/compiler-cli and typescript together with @angular/cli in the same place, or I just had a stroke of luck

Closing as there seem to be suggestion to address the problem.

This problem seems to depend on your environment. If you are running npm in production mode (npm install --prod or if you have NODE_ENV=production somewhere), then only dependencies in your package.json will be installed. The packages in devDependencies will not be installed.

But many packages in devDependencies are needed to build your app. So you either don’t install in prod mode, or move the needed devDependencies over to dependencies.

after creating ng new Projectfoldername when i run “npm start” Im getting this error

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. npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! client@0.0.0 start: ng serve npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the client@0.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\sudhakar reddy\AppData\Roaming\npm-cache_logs\2017-11-18T05_09_02_679Z-debug.log

I tried reinstalling i tried force install many ways but everything is not working I’m trying from Last 18 Hrs trying many ways to Overcome none of them is working. Anyone Help me

By default, npm install will install all modules listed as dependencies. With the --production flag, npm will not install modules listed in devDependencies. either we can go for @sudhakar216 solution of editing the package.json or

To install dev dependencies, npm --production=false install will work even with NODE_ENV=production.

Or you can run NODE_ENV=development npm install

https://github.com/npm/npm/issues/6803

Good to see my 23 hrs of searching is useful for people feeling good in heart thanks for posting Atereshkov

Could you check that your “@angular/compiler” in your dependencies is compatible with angular/cli version:

https://stackoverflow.com/a/47328497/2633707