Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng update to v8 causes [error] Error: Job name "..getProjectMetadata" does not exist. #16902

Closed
1 of 15 tasks
johnpapa opened this issue Feb 9, 2020 · 24 comments
Closed
1 of 15 tasks
Labels
needs: repro steps We cannot reproduce the issue with the information given

Comments

@johnpapa
Copy link
Contributor

johnpapa commented Feb 9, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • 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.

@clydin
Copy link
Member

clydin commented Feb 10, 2020

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

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Feb 10, 2020
@indrapalijama
Copy link

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)

@indrapalijama
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • 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)

@sterlp
Copy link

sterlp commented Feb 23, 2020

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",

@steflen
Copy link

steflen commented Feb 27, 2020

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",

@JoshWilliams92
Copy link

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

@shutupandshave
Copy link

  • 1

@huwprosser
Copy link

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

@HuguesGauthier
Copy link

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

@sdepouw
Copy link

sdepouw commented Mar 13, 2020

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.)

@rineez-livares
Copy link

rineez-livares commented Mar 26, 2020

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?

@andrei-gheorghiu
Copy link

andrei-gheorghiu commented Mar 26, 2020

@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.

@clydin
Copy link
Member

clydin commented Mar 26, 2020

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: npm/cli#726

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

@lenichols
Copy link

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

@Apro123
Copy link

Apro123 commented Apr 1, 2020

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

daemonraco added a commit to daemonraco/ng-drtools that referenced this issue Apr 7, 2020
* Rearranging the package to make it compatible with Angular 8.
    * Keep this bug report close to you: angular/angular-cli#16902
* Bug fixes.
@sudheendrakv
Copy link

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]

@cyrilregal
Copy link

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]

@watat83
Copy link

watat83 commented Apr 29, 2020

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

@NaveenS-git
Copy link

NaveenS-git commented May 13, 2020

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

@jdhines
Copy link

jdhines commented May 13, 2020

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

@rineez-livares
Copy link

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

@jdhines
Copy link

jdhines commented May 14, 2020

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"
  }

@alan-agius4
Copy link
Collaborator

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

See: #16902 (comment)

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: repro steps We cannot reproduce the issue with the information given
Projects
None yet
Development

No branches or pull requests