Angular-cli: ng update to v8 causes [error] Error: Job name "..getProjectMetadata" does not exist.

Created on 10 Feb 2020  路  24Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


  • [ ] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [x] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Description

A clear and concise description of the problem...
When I run ng update @angular/cli@8 @angular/core@8, I then get an error when I run ng build

[error] Error: Job name "..getProjectMetadata" does not exist.

Details are also here https://stackoverflow.com/questions/59447679/an-unhandled-exception-occurred-job-name-getprojectmetadata-does-not-exist

I resolved this by running npm i @angular-devkit/[email protected]

I expected that updating to v8 would resolve this.

repro steps

Most helpful comment

Same here!

after and "npm audit fix" I got the same error. After a check I have seen:
"@angular-devkit/build-angular": "^0.900.3",

Downgrade to:
"@angular-devkit/build-angular": "~0.803.24",

All 24 comments

getProjectMetadata only exists in version 9.0 or higher.
Can you provide a reproduction demonstrating the problem?

In my case, the version of my Angular is still Angular 8, but somehow it still thinks that I'm using Angular 9, so the @angular-devkit/build-angular version in package.json became ^0.900.1, which seems not suitable for Angular 8.
So what worked for me was downgrading this dependency to the fixed version that I've used before (0.803.8)

馃悶 Bug report

Command (mark with an x)

  • [ ] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [x] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Description

A clear and concise description of the problem...
When I run ng update @angular/cli@8 @angular/core@8, I then get an error when I run ng build

[error] Error: Job name "..getProjectMetadata" does not exist.

Details are also here https://stackoverflow.com/questions/59447679/an-unhandled-exception-occurred-job-name-getprojectmetadata-does-not-exist

I resolved this by running npm i @angular-devkit/[email protected]

I expected that updating to v8 would resolve this.

you can try version 0.803.8, the version before the one you post (in Angular 9)

Same here!

after and "npm audit fix" I got the same error. After a check I have seen:
"@angular-devkit/build-angular": "^0.900.3",

Downgrade to:
"@angular-devkit/build-angular": "~0.803.24",

had the same issue from accidentally installing latest version of custom-webpack
my fix was to downgrade "@angular-builders/custom-webpack": "9.0.0" to "@angular-builders/custom-webpack": "^8.4.1",

I was receiving the same error.
Downgrading to "@angular-devkit/build-angular": "~0.803.24", fixed the issue for me.

  • 1

Downgrading to "@angular-devkit/build-angular": "~0.803.24", also fixed the issue for me.

Same for me, Downgrading to "@angular-devkit/build-angular": "~0.803.24", also fixed the issue for me.

Another +1 from me on downgrading the build-angular package to ~0.803.24. Had to do so after creating a new Angular SPA project from Visual Studio 2019. After running npm audit fix (because out-of-the-box the project template has a ton of vulnerabilities), I encountered this issue.

Also I feel a little silly admitting this, but make sure that, after you downgrade said package, you run npm install again! Otherwise you'll still be building with the version that causes the error. (I downgraded by changing the json file and was still getting errors since I immediately ran ng build. I assume if you downgrade using npm instead of just changing the file, you don't have to take this extra step manually.)

npm audit fix making such a breaking upgrade automatically: Is that normal?
Doesn't that seem like something gone wrong from the side of some package maintainer? Probably in package @angular-devkit/build-angular itself? Is there any bug report filed already?

@rineez-livares Yep, it's normal if you prefix the package version with ^.

This allows audit to update to the highest minor version it finds. What's not normal is that @angular-devkit/build-angular uses minors to differentiate between builders for majors of angular. The solution is to use ~ prefix for @angular-devkit/build-angular , like this:

"@angular-devkit/build-angular": "~0.803",

Now npm audit fix won't upgrade it to 0.90x... anymore. But will upgrade it to latest in 0.803.* range, so you get any patches aimed at v8 builder.

Same goes for @angular/pwa, if anyone uses it.

When a semantic version's major is a zero than the minor version is treated as a major and the carat (^) and tilde (~) are equivalent. (https://github.com/npm/node-semver#caret-ranges-123-025-004)

If npm audit fix is not respecting that then it most likely has a defect. There appears to be an open issue on npm's project regarding a different dependency with a similar situation: https://github.com/npm/cli/issues/726

Executing npm i @angular-devkit/build-angular@^0.803.24 will install 0.803.25 so this appears isolated to npm audit fix.

"@angular-devkit/build-angular": "~0.803" - worked for me...

For newbies (Like me):
Go to package.,json
find and change to "@angular-devkit/build-angular": "~0.803"
then run npm i.

The fix suggested by Apro123 works. However as an alternative, one can directly downgrade the angular-devkit by running below npm command.

npm i @angular-devkit/[email protected]

Same here!

after and "npm audit fix" I got the same error. After a check I have seen:
"@angular-devkit/build-angular": "^0.900.3",

Downgrade to:
"@angular-devkit/build-angular": "~0.803.24",

Same here too, resolution : npm i @angular-devkit/[email protected]

Same here! If your app was working and then one of a sudden it start crashing, it's probably because of the almighty "npm audit fix" which is supposed to save our lives.

So In my case, I noticed this in my package.json
"@angular-devkit/build-angular": "^0.901.3",

So I Downgraded to:
"@angular-devkit/build-angular": "~0.803.2",

and then finally I npm i. Don't forget to reinstall the dependencies in your package.json after you manually update them. it will save you couple hours

Same here! If your app was working and then one of a sudden it start crashing, it's probably because of the almighty "npm audit fix" which is supposed to save our lives.

So In my case, I noticed this in my package.json
"@angular-devkit/build-angular": "^0.901.3",

So I Downgraded to:
"@angular-devkit/build-angular": "~0.803.2",

and then finally I npm i. Don't forget to reinstall the dependencies in your package.json after you manually update them. it will save you couple hours

After running npm audit fix,
"@angular-devkit/build-angular":"^0.901.5"
I manually downgrade to 0.803.25

Now error "..getProjectMetadata" does not exist
How to reinstall the dependencies

What to do in my case, where there are no @angular-devkit dependencies in package.json, but when I do ng version I see this? (I previously wiped node_modules and package_lock, reinstalled, then did ng update @angular/cli@8 @angular/core@8.

````
Angular CLI: 8.3.26
Node: 10.15.3
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, platform-webworker
... platform-webworker-dynamic, router, upgrade

Package Version

@angular-devkit/architect 0.901.5
@angular-devkit/build-angular 0.901.5
@angular-devkit/build-optimizer 0.901.5
@angular-devkit/build-webpack 0.901.5
@angular-devkit/core 8.3.26
@angular-devkit/schematics 8.3.26
@angular/cdk 8.2.3
@angular/cli 8.3.26
@angular/material 8.2.3
@ngtools/webpack 9.1.5
@schematics/angular 8.3.26
@schematics/update 0.803.26
rxjs 6.5.5
typescript 3.9.2
webpack 4.42.0
````

@jdhines That's surprising to her. I think seeing your package.json also will help to figure out this easily.

Should I have had the @angular-devkit/... saved in dependencies? If they should be, I don't know why they wouldn't, unless one time I installed them I just forgot to add a flag, but it's been such a long time ago I don't remember if I installed them manually during an upgrade (I started this project on Angular 4) or if they were part of ng new.

````
"dependencies": {
"@angular/cdk": "^8.2.3",
"@angular/material": "^8.2.3",
"@ng-bootstrap/ng-bootstrap": "^5.3.1",
"core-js": "^2.4.1",
"jqwidgets-scripts": "^5.6.0",
"lodash": "^4.17.11",
"ngx-spinner": "^8.1.0",
"rxjs": "^6.5.5",
"typescript": "^3.5.3",
"web-animations-js": "^2.3.1",
"zone.js": "^0.9.1"
},
"devDependencies": {

"@angular/animations": "^8.2.14",
"@angular/cli": "^8.3.26",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/compiler-cli": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/platform-server": "^8.2.14",
"@angular/platform-webworker": "^8.2.14",
"@angular/platform-webworker-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",
"@angular/upgrade": "^8.2.14",
"@testing-library/angular": "^7.1.0",
"@testing-library/jest-dom": "^4.0.0",
"@types/jest": "^23.3.14",
"@types/lodash": "^4.14.109",
"@types/node": "~6.0.60",
"codelyzer": "^5.2.2",
"file-saver": "1.3.3",
"jest": "^24.8.0",
"jest-preset-angular": "^7.1.1",
"moment": "2.17.1",
"prettier": "^1.19.1",
"replace-in-file": "^3.4.2",
"ts-jest": "^24.0.2",
"ts-node": "~2.0.0",
"tslint": "^5.7.0",
"tslint-config-prettier": "^1.10.0",
"xlsx": "0.14.1"

}
````

Closing as this seems to be an issue which is caused by npm audit fix rather than Angular CLI.

See: https://github.com/angular/angular-cli/issues/16902#issuecomment-604621497

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings