196

I am getting this error while running my application. Here are the details of my application.

Angular CLI: 7.3.3 
Node: 10.15.1 
Angular: 7.2.7 
@angular-devkit/architect -0.13.3 
@angular-devkit/build-angular- 0.800.1 
@angular-devkit/build-optimizer - 0.800.1 
@angular-devkit/build-webpack - 0.800.1 
@angular-devkit/core -7.3.3 
@angular-devkit/schematics -7.3.3 
@angular/cli -7.3.3 
@ngtools/webpack -8.0.1 
@schematics/angular -7.3.3 
@schematics/update 0.13.3 
rxjs 6.3.3 
typescript 3.2.4 
webpack 4.30.0

I have already tried cache clean.

A. Wolf
  • 1,309
  • 17
  • 39
Ekta Gandhi
  • 1,979
  • 2
  • 7
  • 5
  • Here is the detail of my application. Angular CLI: 7.3.3 Node: 10.15.1 Angular: 7.2.7 @angular-devkit/architect -0.13.3 @angular-devkit/build-angular- 0.800.1 @angular-devkit/build-optimizer - 0.800.1 @angular-devkit/build-webpack - 0.800.1 @angular-devkit/core -7.3.3 @angular-devkit/schematics -7.3.3 @angular/cli -7.3.3 @ngtools/webpack -8.0.1 @schematics/angular -7.3.3 @schematics/update 0.13.3 rxjs 6.3.3 typescript 3.2.4 webpack 4.30.0 – Ekta Gandhi May 31 '19 at 10:22
  • 1
    This issue is generally because of incompatible packages. Have you recently updated package.json? – Deepika May 31 '19 at 11:44
  • No i haven't update package.json file. – Ekta Gandhi Jun 03 '19 at 04:58
  • 7
    Finally i found the solution. 1)Firstly eliminate all changes in package.json file by giving simple command git checkout package.json. 2)Then after make change in package.json in @angular-devkit/build-angular- ~0.800.1(Add tail instead of cap) 3)Then run command rm -rf node_modules/ 4)Then clean catch by giving command npm clean cache -f 5)And at last run command npm install. This works for me. – Ekta Gandhi Jun 04 '19 at 09:59
  • 2
    Above, `npm clean cache -f` is wrong, should be `npm cache clean --force` . – Fabien Haddadi Aug 22 '19 at 00:30
  • 3
    What I found is that I had set nvm to use the wrong version of node, needed to set that properly using `nvm use 12.14.01` (in my case) – QuietSeditionist Feb 05 '20 at 21:57

18 Answers18

193

In your package.json change the devkit builder.

"@angular-devkit/build-angular": "^0.800.1",

to

"@angular-devkit/build-angular": "^0.10.0",

it works for me.

starball
  • 20,030
  • 7
  • 43
  • 238
idirene youcef
  • 1,985
  • 1
  • 6
  • 6
  • 35
    Made it to `@angular-devkit/build-angular": "0.13.4"` and it worked. – Dimuthu Jun 04 '19 at 08:13
  • 4
    Perfect. Worked with "0.13.4", and running npm build afterwards – SouravOrii Jun 04 '19 at 19:20
  • 1
    Landed here because I got a notification about a security vulnerability detected in js-yaml < 3.13.1. After updating that I got this error message. Anyways, `"^0.10.0"` fixed it. – Alesh Houdek Jun 05 '19 at 10:08
  • 11
    the 0.13.4 worked for me, however make sure you remove the node_modules folder first, delete the package-lock.json and then run npm install. seems to fix everything. – Indy-Jones Jul 25 '19 at 03:58
  • 5
    This solution works but it's wrong, you should instead upgrade the angular and angular cli version. Check @ovangle answer below – Francesco Borzi Jul 30 '19 at 10:31
  • Perfect. Worked with "0.13.4", and running npm build afterwards – dEL Sep 02 '19 at 13:06
  • Please refer to @abasar answer. It should resolve the issue. – mighty_mike Nov 04 '19 at 15:35
  • This answer is outdated, refer this: https://stackoverflow.com/a/59043569/6122411 – zhuhang.jasper Nov 26 '19 at 04:05
  • Even though the comments above are stating this solution is outdated, it worked perfectly for me in June 2020. How you found this out is beyond me, but take my upvote! – Obsidian Age Jun 11 '20 at 01:17
  • This answer was upvoted and does not clearly give a reason or source to support the response aside from "it works for me." – Zakky Jun 22 '20 at 06:40
  • @angular-devkit/build-angular": "0.13.4" and running npm install, worked for me – Flowra Dec 08 '20 at 01:21
121

Following worked for me

npm uninstall @angular-devkit/build-angular
npm install @angular-devkit/build-angular@0.13.0
abasar
  • 1,659
  • 1
  • 12
  • 7
  • 7
    Although this answer is direct, it as well lacks resource or reference. Blindly directly people to install a particular package version may disrupt their entire project. Please be clear and provide some reference. – Zakky Jun 22 '20 at 06:41
  • npm install @angular-devkit/build-angular@0.13.4 worked – webjockey Feb 17 '21 at 06:07
86

Everyone here is focusing on downgrading @angular-devkit/build-angular to @angular 7.x versions for compatibility, but what they should be doing is to upgrade @angular/cli to angular 8 versions.

The problem is that the system cli is still stuck at an old version and isn't automatically updated by ng update (because it is outside the angular controlled project), so it is being left at an incompatible version when trying to access the angular libraries.

Downgrading @angular-devkit/build-angular just causes more incompatibilities.

npm i --global @angular/cli@latest

will fix the problem without breaking things elsewhere.

ovangle
  • 1,991
  • 1
  • 15
  • 29
  • 6
    This should be the answer. This error occurred to me because I pulled from a branch that has been updated to Angular 8 but my computer's angular is still Angular 7. – terahertz Aug 26 '19 at 14:01
  • 23
    this issue can occur when you do `npm audit fix` on projects that are still on `angular@7` so sometimes downgrading `@angular-devkit/build-angular` is the correct answer – Xesenix Sep 27 '19 at 09:23
  • 4
    running `npm audit fix` sometimes introduces braking changes. we should instead run `npm audit` to understand the findings and upgrade the package 1 by 1 using something like `npm i --save-dev ` – Naren Oct 07 '19 at 18:27
  • Upgrading `angular-cli` is WORSE than downgrading devkit packages. The correct versions to downgrade/upgrade should depends on your current CLI version. See: https://stackoverflow.com/a/59043569/6122411 – zhuhang.jasper Nov 26 '19 at 04:07
  • 1
    @zhuhang That is just patently false. You can expect upgrading the global CLI to be backwards compatible with the last few versions, you cannot necessarily expect it to be forwards compatible. – ovangle Nov 27 '19 at 19:37
  • 1
    @ovangle I did not mention forward compatible. I am saying people should not blindly upgrade or downgrade, especially the `angular-cli` version. One should identify their current CLI version and use the devkit that matches that CLI. If you want to upgrade devkit packages, then upgrading CLI altogether is correct. – zhuhang.jasper Nov 28 '19 at 02:57
  • @ovangle besides, in most cases, the devkit got updated accidentally, so the author sees the error. Author should downgrade the devkit, instead of upgrading CLI. However, if author indeed needs the latest devkit, then the author definitely SHOULD upgrade his CLI to a matching version. – zhuhang.jasper Nov 28 '19 at 03:02
  • Perfect answer. Upgrade instead of a downgrade. – Pranjal Successena Dec 24 '19 at 07:31
  • I also had to resolve the CHOWN issue for EACCESS errors. The hints on this involved setting the ownership for ~/.npm, and I had to, also, set for ~/.npm-global – mobibob Feb 23 '20 at 12:20
82

Everyone is focusing on downgrading @angular-devkit/build-angular version to X, or upgrading @angular/cli version to Y or latest.

However, Please do not blindly suggest an X or Y or latest as answers. (Though usually, downgrading devkit should be better because upgrading CLI is a breaking change)

The correct version to choose, always depends on your Angular (angular-cli) version.

Angular CLI v8.3.19 -> 0.803.19
Angular CLI v8.3.17 -> 0.803.17
Angular CLI v7.3.8 -> 0.13.8
Angular CLI v6-lts -> 0.8.9

For other specific versions, visit: https://github.com/angular/angular-cli/tags. Find your CLI version, and in some tags, they do mention the corresponding versions for @angular-devkit/** packages.

Note: If you want to upgrade your CLI version, you should first consider upgrading to latest of your major version, do not simply jump to the next major version.

zhuhang.jasper
  • 4,120
  • 4
  • 21
  • 29
  • 3
    Not sure why this answer was down-voted; it is good advice. In fact, it solved my problem (as I had upgraded my `devkit/build-angular` package to `0.803.x` but left my Angular CLI at `7.3.x`. Since I didn't intend to upgrade my Angular CLI, I went back to using ver `0.13.x` of devkit – Gregg L Dec 06 '19 at 19:47
  • 2
    @GreggL In fact, my answer is better than the one with most upvotes. Other answers simply suggests to upgrade/downgrade BLINDLY. As my answer suggests, the correct CLI/ devkit version correlates, but no one gives a F, because that's how the dev community is. – zhuhang.jasper Dec 09 '19 at 10:01
  • You're a lifesaver, tx ! But do you have any idea for cli 7.0.6? [It doesn't written there](https://github.com/angular/angular-cli/releases/tag/v7.0.6) – Erhan Yaşar Feb 17 '20 at 10:55
  • 2
    To add to this great answer : In my own project, I include `@angular/cli` in the dev dependencies and I make sure it matches the `@angular-devkit/build-angular`. That way I can maintain multiple projects with multiple CLI version. If you do `ng s` it will use your computer CLI, if you do `npm start` (which is a script in `package.json` to do `ng serve` it will actually use the local CLI it launch this app with the right CLI. Hope this helps – m-a.D Mar 10 '20 at 13:21
  • Updated for Angular 9, as of today (source [NPM](https://www.npmjs.com/package/@angular-devkit/build-angular?activeTab=versions)): 0.901.1 -> latest, 0.1000.0-next.0 -> next, 0.8.9 -> v6-lts, 0.803.26 -> v8-lts, 0.13.10 -> v7-lts – massic80 Apr 17 '20 at 16:01
31

Your @angular-devkit is incompatible with @angular/cli version, so just install older one like this for example:

npm install @angular-devkit/build-angular@0.13.8 @angular-devkit/build-ng-packagr@0.13.8
27

Same issue after trying to upgrade to Ng8 which failed due to dependency issues.

npm uninstall @angular-devkit/build-angular

then I used,

npm install @angular-devkit/build-angular@0.12.4

fixed it...

Raj Baral
  • 661
  • 6
  • 19
Alfa Bravo
  • 1,961
  • 2
  • 25
  • 45
  • sometimes this solution is not feasible because it's version might not someone's requirement. Delete package lock json `npm i @angular-devkit/build-angular ` – Tejashree Mar 27 '20 at 11:22
16

I had the same problem, but I solved it thanks to the comment of Ekta Gandhi:

Finally i found the solution.

1) Firstly eliminate all changes in package.json file by giving simple command git checkout package.json.

2) Then after make change in package.json in @angular-devkit/build-angular- ~0.800.1(Add tail instead of cap)

3) Then run command rm -rf node_modules/

4) Then clean catch by giving command npm clean cache -f

5) And at last run command npm install. This works for me.

.... Along with the modification proposed by Dimuthu

Made it to @angular-devkit/build-angular": "0.13.4" and it worked.

rrawat
  • 1,071
  • 1
  • 15
  • 29
  • It should be noted that version "0.13.4" of @angular-devkit/build-angular has an issue when using lazy loaded components. To avoid that issue users need to update their @angular-devkit/build-angular package... So sort of a trade off here... – Ares Dec 06 '19 at 17:44
9

This happened to me when I installed Angular 8, there are some incompatibilities I couldn't solve. I had to downgrade because I went down the rabbit hole juggling around with every version until I found one that worked.

First, TypeScript was outdated, the default installation added a reference to TypeScript 3.1.6 and it requires 3.4 or greater.

npm install typescript@">=3.4 <3.5"

Second, using the devkit 0.800.1 or 0.800.1 always ended up in incompatibilities. I tried many combinations but I am not sure it's fully compatible yet, specially because I am using one bootstrap a bit older and I cannot upgrade yet.

Finally I tried to downgrade (go to package.json and find the devDependencies) until one of them worked.

@angular-devkit/build-angular": "0.13.4"

I am sure your problem is dependencies versions but I cannot tell you which one. Give it a try downgrading.

Maximiliano Rios
  • 2,196
  • 2
  • 20
  • 34
  • Whilst it works, I would suggest `@angular-devkit/build-angular": "0.13.8"`as it seems to be the latest version that works – Maartenw Jun 05 '19 at 14:37
  • Thanks a lot. It seems by bootstrap version or dependencies don't let me go higher than 0.13.4 but it would work for many people – Maximiliano Rios Jun 05 '19 at 14:41
  • With 0.13.8 (essentially anything lower than 0.800.*) I get: `An unhandled exception occurred: Could not find the implementation for builder @angular-devkit/build-angular:browser See "/tmp/ng-5iKcHN/angular-errors.log" for further details.` With latest version I get error from title. What to do now? – Dominik Szymański Jul 21 '19 at 23:41
7

I was also coming across this issue and for me when doing more updates more issues occurred.

What worked for me in the end was more or less to remove angular cli and re install it with these steps:

npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli

this helped me out source: how to uninstall angular/cli

tony2tones
  • 1,422
  • 1
  • 18
  • 19
2

I also faced this issue and struggled hours to solve it, I have tried all of the above options but nothing solved my problem. This issue occurs due to version mismatch of angular/cli and angular-devkit, so I did the following :

  1. Manually changed version of files:

    @angular-devkit/build-angular": "^0.13.9",

    @angular/cli": "~7.0.3", //This is for Angular7, for Angular8 : 0.803.23

  2. Deleted package-lock.json

  3. Executed : npm install

It solved my problem.

1

On my side it was package

@angular-devkit/build-angular

and

@angular-devkit/build-ng-packagr

was not the same version, Updating build-ng-packagr to same version as build-angular fixed my problem.

Bdwey
  • 1,813
  • 1
  • 16
  • 18
1

If your moving to angular 8 or 9 this will do the trick

ng update @angular/cli
Victor
  • 59
  • 6
0

You can simply audit your code and then

#sudo su 
rm -rf package-lock.json node_modules
sudo npm i --save 
D. Schreier
  • 1,700
  • 1
  • 22
  • 34
0

What actually worked for me was to update the application and its dependencies with:

ng update @angular/cli @angular/core

Angular documentation

yanioconjota
  • 104
  • 1
  • 6
-1

You have incompatibly dependencies i solved this problem by change the package.json form another project angular and then after change to this packag.json, you change only the dependencies versions you have.

after the change write:

-npm link

-npm serve -o

then it's work :)

   {
   "name": "angular-jwt-auth",
   "version": "0.0.0",
   "scripts": {
   "ng": "ng",
   "start": "ng serve",
   "build": "ng build",
   "test": "ng test",
   "lint": "ng lint",
   "e2e": "ng e2e"
   },
   "private": true,
   "dependencies": {
   "@angular/animations": "^7.1.4",
   "@angular/cdk": "^7.3.1",
   "@angular/common": "~7.1.0",
   "@angular/compiler": "~7.1.0",
   "@angular/core": "~7.1.0",
   "@angular/forms": "~7.1.0",
   "@angular/http": "^6.1.10",
   "@angular/material": "^7.3.1",
   "@angular/platform-browser": "~7.1.0",
   "@angular/platform-browser-dynamic": "~7.1.0",
   "@angular/router": "~7.1.0",
   "@ng-bootstrap/ng-bootstrap": "^4.2.0",
   "@types/jquery": "^3.3.29",
   "angular-6-datatable": "^0.8.0",
   "bootstrap": "^4.3.1",
   "chart.js": "^2.8.0",
   "core-js": "^2.5.4",
   "jquery": "^3.4.1",
   "rxjs": "~6.3.3",
   "zone.js": "~0.8.26"
    },
   "devDependencies": {
   "@angular-devkit/build-angular": "~0.11.0",
   "@angular/cli": "~7.1.0",
   "@angular/compiler-cli": "~7.1.0",
   "@angular/language-service": "~7.1.0",
   "@types/chart.js": "^2.7.53",
   "@types/jasmine": "^2.8.16",
   "@types/jasminewd2": "^2.0.6",
   "@types/node": "~8.9.4",
   "codelyzer": "~4.2.1",
   "jasmine-core": "~2.99.1",
   "jasmine-spec-reporter": "~4.2.1",
   "karma": "~3.1.1",
   "karma-chrome-launcher": "~2.2.0",
   "karma-coverage-istanbul-reporter": "~2.0.1",
   "karma-jasmine": "~1.1.2",
   "karma-jasmine-html-reporter": "^0.2.2",
   "protractor": "~5.4.0",
   "ts-node": "~7.0.0",
   "tslint": "~5.11.0",
   "typescript": "~3.1.6"
   }
Mohamad Alhamid
  • 346
  • 4
  • 15
  • I have tried it and it give me same error errors: Data path "" should NOT have additional properties(es5BrowserSupport). – Ekta Gandhi Jun 03 '19 at 04:49
-1

I had this issue, this is how i have solved it. The problem mostly is that your Angular version is not supporting your Node.js version for the build. So the best solution is to upgrade your Node.js to the most current stable one.

For a clean upgrade of Node.js, i advise using n. if you are using Mac.

npm install -g n
npm cache clean -f
sudo n stable
npm update -g

and now check that you are updated:

node -v
npm -v

For more details, check this link: here

arielb
  • 392
  • 3
  • 10
  • Would be happy to know why i got this downvote. This is a clean answer, without trying to have some "workarounds" – arielb Sep 19 '19 at 08:56
  • because its not related to node version, it should be angular-cli version. – zhuhang.jasper Nov 26 '19 at 08:15
  • I just had this issue, i don't think it's the angular-cli version, it IS related to the angular-cli but it affected by the node version. – arielb Nov 27 '19 at 14:20
-1

NONE of the above-given answers works for me.

My original goal was to fix the sometimes CONSTANT COMPILING of my project with VSCode.

I tried many, many ways, but NOTHING was working -- the project just WON'T COMPILIE!

Finally I found out what the problem here is:

I cloned the project from my company's repository, and all the code from there HAS TO go exactly with the versions of dependencies when the existing part of the project was coded.

In the end, I deleted the previously cloned project AGAIN (quite a few times), and cloned AGAIN (also a few times), and DID NOTHING BUT RAN "npm install", and everything started to work.

The lesson I learned here is that:

Sometimes you'll make the situation worse when you try to fix some problems (the one I had was the CONSTANT COMPILING of my project).

But it doesn't mean we cannot try to fix the problems. We can. But when everything becomes a mess, we'd better go with the original code.

Fortunately the CONSTANT COMPILING of my project happens only once a while, not all the time. It's not fixed, but I have to bear with it, otherwise my project won't even compile.

William Hou
  • 1,251
  • 14
  • 17
-2

it's work reinstall @angular-devkit/build-angular@0.13.4

npm install @angular-devkit/build-angular@0.13.4 --save-dev
ahmeturhan
  • 57
  • 2
  • 5