问题
I updated my angular to v9 and when I try to go back in v8, I receive this error. I have already tried the following:
- uninstall -global angular/cli
- uninstall angular/cli
- go back to my last package.json
- delete node_module folder
- delete repo
This error continues to show.
My stacktrace is :
An unhandled exception occurred: Job name "..getProjectMetadata" does not exist.
See angular-errors.log for further details.
angular-errors.log :
[error] Error: Job name "..getProjectMetadata" does not exist.
at Observable._subscribe (/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.js:350:23)
at Observable._trySubscribe (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Observable.js:44:25)
at Observable.subscribe (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Observable.js:30:22)
at /Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/util/subscribeTo.js:22:31
at Object.subscribeToResult (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/util/subscribeToResult.js:10:45)
at SwitchMapSubscriber._innerSub (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:65:54)
at SwitchMapSubscriber._next (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:55:14)
at SwitchMapSubscriber.Subscriber.next (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
at SwitchMapSubscriber.notifyNext (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:86:26)
at InnerSubscriber._next (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
at InnerSubscriber.Subscriber.next (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
at /Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/util/subscribeTo.js:17:28
at Object.subscribeToResult (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/util/subscribeToResult.js:10:45)
at SwitchMapSubscriber._innerSub (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:65:54)
at SwitchMapSubscriber._next (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:55:14)
at SwitchMapSubscriber.Subscriber.next (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
ng --version :
Angular CLI: 8.3.18
Node: 12.15.0
OS: darwin x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.18
@angular-devkit/build-angular 0.900.1
@angular-devkit/build-optimizer 0.900.1
@angular-devkit/build-webpack 0.900.1
@angular-devkit/core 8.3.18
@angular-devkit/schematics 8.3.18
@angular/cdk 8.2.3
@angular/cli 8.3.18
@angular/material 8.2.3
@ngtools/webpack 9.0.1
@schematics/angular 8.3.18
@schematics/update 0.803.18
rxjs 6.5.3
typescript 3.5.3
webpack 4.41.2
回答1:
It seems to be an issue with @angular-devkit/build-angular..
Try downgrading it to a specific version:
npm i @angular-devkit/build-angular@0.803.24
回答2:
Run also npm i @angular-builders/custom-webpack@8.4.1 --save
For me Occian's answer was not enough, I also had to change @angular-builders/custom-webpack from latest to 8.4.1, because it had build-angular dependency too. This is how to figure it out:
npm list @angular-devkit/build-angular
reports-web-client@0.0.0 C:\projects\2778\reports-web-client +-- @angular-builders/custom-webpack@9.1.0 | `-- @angular-devkit/build-angular@0.901.1 `-- @angular-devkit/build-angular@0.803.8
Which meant, I had 2 versions of the package, and that's why the error would still show up.
回答3:
If you use npm audit fix, find the package which you tried to fix and restore to a stable version and be aware with vulnerabilities.
回答4:
This command fixes the situation temporarily:
npm i @angular-devkit/build-angular@0.803.24
My Jenkins build requires me to run the npm audit fix command to download dependencyes. This command makes the same error appear again. Anyone have any idea how to make the audit command ignore angula-devkit?
回答5:
I had the same issue and solved it by downgrading @angular-devkit/build-angular. version to 0.803.24 as Occian Fumnanya Dia said in his answer above
If after downgrading the version you still get the same error, try deleting the folder platforms and re-run with ionic cordova run <platform>. Replace <platform> with android or ios.
It will recreate the folder plaforms with new things.
Hope it helps.
回答6:
Personally, the best solution is:
ng update @angular/cli @angular/core
Why? Because sooner or later, you need to upgrade to Angular 9+ and the other solutions are only to downgrade it.
I was facing the same issue today until I used this solution and this one works perfectly well.
回答7:
i fixed it by open
package.json file
and update on the next line
@angular-devkit/build-angular": "^0.803.8"
then run
npm i
回答8:
Instead of deleting the whole node_modules folders, just rename it and try
npm install
sudo npm install --unsafe-perm //for macOS
Please find below my angular packages versions -
"@angular-devkit/build-angular": "0.802.0",
"@angular-devkit/core": "8.2.0",
"@angular/animations": "8.2.0",
"@angular/cli": "8.2.0",
"@angular/common": "8.2.0",
"@angular/compiler": "8.2.0",
"@angular/compiler-cli": "8.2.0",
"@angular/core": "8.2.0",
回答9:
From my experience a new module that you are using is designed for angular9 and you should upgrade your imports if possible to:
"dependencies": {
"@angular/animations": "^9.1.9",
"@angular/cdk": "^9.2.4",
"@angular/common": "^9.1.9",
"@angular/compiler": "^9.1.9",
"@angular/core": "^9.1.9",
"@angular/forms": "^9.1.9",
"@angular/platform-browser": "^9.1.9",
"@angular/platform-browser-dynamic": "^9.1.9",
"@angular/router": "^9.1.9",
...
}
"devDependencies": {
"@angular-devkit/build-angular": "^0.901.7",
"@angular/cli": "^9.1.7",
"@angular/compiler-cli": "^9.1.9",
"@angular/language-service": "^9.1.9",
...
}
来源:https://stackoverflow.com/questions/60174503/job-name-getprojectmetadata-does-not-exist