-
Notifications
You must be signed in to change notification settings - Fork 12k
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
npm install
fails with NPM 7
#19957
Comments
I've encountered similar issues (NPM 7.5.2), but when creating new project (
And when trying to
Both these were working just fine with NPM 6.x. But just looking at these errors, peer dependencies seem to mismanaged. Environment:
|
I've encountered the same error
For more information, the json: {
"code": "ERESOLVE",
"current": {
"name": "typescript",
"version": "4.1.3",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/typescript",
"dependents": [
{
"type": "dev",
"name": "typescript",
"spec": "~4.1.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
},
{
"type": "peer",
"name": "typescript",
"spec": "~4.0.0 || ~4.1.0",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.1101.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular-devkit/build-angular",
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "~0.1101.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
}
]
}
},
{
"type": "peer",
"name": "typescript",
"spec": ">=4.0 <4.2",
"from": {
"name": "@angular/compiler-cli",
"version": "11.1.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular/compiler-cli",
"dependents": [
{
"type": "dev",
"name": "@angular/compiler-cli",
"spec": "~11.1.1",
"from": {
"location": "/home/saadi/Coding/pwa"
}
},
{
"type": "peer",
"name": "@angular/compiler-cli",
"spec": "^11.0.0 || ^11.1.0-next",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.1101.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular-devkit/build-angular",
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "~0.1101.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
}
]
}
},
{
"type": "peer",
"name": "@angular/compiler-cli",
"spec": "11.1.2",
"from": {
"name": "@angular/localize",
"version": "11.1.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular/localize",
"dependents": [
{
"type": "peerOptional",
"name": "@angular/localize",
"spec": "^11.0.0 || ^11.1.0-next",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.1101.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular-devkit/build-angular",
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "~0.1101.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
}
]
}
}
]
}
},
{
"type": "peer",
"name": "@angular/compiler-cli",
"spec": "^11.0.0",
"from": {
"name": "ng-packagr",
"version": "11.1.3",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/ng-packagr",
"dependents": [
{
"type": "peerOptional",
"name": "ng-packagr",
"spec": "^11.0.0 || ^11.1.0-next",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.1101.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular-devkit/build-angular",
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "~0.1101.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
}
]
}
}
]
}
}
]
}
},
{
"type": "peer",
"name": "typescript",
"spec": ">=4.0 <4.2",
"from": {
"name": "ng-packagr",
"version": "11.1.3",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/ng-packagr",
"dependents": [
{
"type": "peerOptional",
"name": "ng-packagr",
"spec": "^11.0.0 || ^11.1.0-next",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.1101.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular-devkit/build-angular",
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "~0.1101.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
}
]
}
}
]
}
}
]
},
"edge": {
"type": "peer",
"name": "typescript",
"spec": "~3.9.5",
"error": "INVALID",
"from": {
"name": "tsickle",
"version": "0.39.1",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/tsickle",
"dependents": [
{
"type": "peerOptional",
"name": "tsickle",
"spec": "~0.39.0",
"from": {
"name": "ng-packagr",
"version": "11.1.3",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/ng-packagr",
"dependents": [
{
"type": "peerOptional",
"name": "ng-packagr",
"spec": "^11.0.0 || ^11.1.0-next",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.1101.2",
"whileInstalling": {
"name": "pwa",
"version": "0.0.0",
"path": "/home/saadi/Coding/pwa"
},
"location": "node_modules/@angular-devkit/build-angular",
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "~0.1101.2",
"from": {
"location": "/home/saadi/Coding/pwa"
}
}
]
}
}
]
}
}
]
}
},
"peerConflict": null,
"strictPeerDeps": false,
"force": false
} |
Hi all, The first error:
Should be solved via #19955 The second error:
Is an NPM bug, kindly see npm/cli#2615, as a workaround we can try to use the |
I guess below is yet another NPM bug, but just FYI once a new Angular release is published, it is impossible to
|
Same error here (On Ubuntu): Angular CLI: 11.1.2 Angular: Package Version@angular-devkit/architect 0.1101.2 (cli-only) |
We talked about this issue in our CLI triage meeting, unfortunately there's a lot of complexity but we think we have a path forward. The most immediate "solution" to this problem is to restrict our Regarding the
Regarding the While we could unpin FW peer deps to use something like Alternatively, this is arguably an NPM 7 bug since there is a solution to dependency resolution which it failed to find. It seems that NPM 7 is picking the latest compatible version of Similarly, For right now, our plan is to do nothing about the |
Hi @dgp1130 we have been trying to raise awareness that the peer dependencies installation behavior from npm@7 has an opt-out option for projects that are unfortunately running into problems with it. While I'm not really familiar with If that's not really the case, we would really appreciate if the warning message could point users running npm@7 to use the Thanks! 😊 |
This answer saved my day :) Thanks a lot ! |
Totally agree with this. NPM explicitly include options to remain legacy behaviour exactly because of this kind of reasons. The .npmrc file could additionally be generated by the CLI for workspaces for new and upgrades just for the time of transition. Requiring everyone to downgrade NPM should be the last option to consider, which is not necessary here... cheers |
@ruyadorno thank you very much for a solution in your comment. |
For those who can't generate new projects with
Later if you need to execute other Angular CLI commands that need to be executed in project folder, such as schematics, you can install NPM 6 to your Angular project as a dev dependency:
|
Thanks for solution @bogacg , it works like a charm! |
How long would a fix take, optimistically? |
Thanks for bringing up Unfortunately, we don't think it's practical to ship this flag to user projects. While Even if we did add such a flag, users would expect us to remove it once Angular is compatible, however it's tricky to do so safely, since users may have added the flag for other reasons. Essentially, we can't assume that just because Angular is fixed means that the whole project is fixed. Automatically removing Long story short, we feel that automatically adding |
Really your only excuse to downgrade npm is because it's easier for you, not for users, so please stop using it as an excuse. |
If you didn't get yet - for some users it's a big problem, for some of us it's just a feeling like we should stuck with the old version of npm (and there is no sight of resolving it) just because of Angular. It is pretty awful feeling and it has nothing common with the feelings like "stability" and "modern framework". It's just some crappy "don't touch it, it stinks" feeling. |
To summarize some earlier points for those who are just finding this issue: We're committed to getting NPM 7 to work with Angular, but are currently blocked on two NPM bugs (one, two). Once those are addressed, we expect Angular will be compatible.
If you are encountering this issue, here are some potential workarounds:
Again, we're hoping these should only be temporary solutions. We are following up with NPM to resolve the blockers and make Angular compatible with NPM 7. |
Quick update here. TL;DR: We released Angular CLI versions We met with some folks from NPM the other day and they have been super helpful in trying to resolve this. Of the original issues mentioned (npm/cli#2553 and npm/cli#2615), only npm/cli#2615 needs to be fixed for Angular right now, as fixing that avoids installing the problem packages that encountered npm/cli#2553. We tested a fix for npm/cli#2615, but found it was still causing some errors. The NPM team filed npm/arborist#223 to look more into that. Once both these issues are fixed, we're hopeful Angular should become compatible with NPM 7. |
The NPM team has made some fixes which seem to address this issue and our internal testing has come back positive. We're pushing out a new release of the CLI later today where we'll remove the assertion error for fixed versions of NPM 7. I'll post an another update here once that is released with the relevant version numbers necessary to be compatible. |
Thanks everyone for your patience, NPM 7 has received some fixes and should be compatible with Angular. We've also released new versions of all supported Angular majors to remove the NPM version assertion error. So everything should work provided you use:
If you are using these versions and still encountering unexpected problems, please file a new issue and we'll take a look. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
This bug did not occur a couple of days ago. It doesn't seem like it's caused by a specific CLI version. It might be caused by some (peer) dependency of a brand-new Angular project which changed its dependencies.
Description
Creating a new Angular project with the Angular CLI (
ng new
) fails when using the latest version of npm (7.5.x).Error message see below.
🔬 Minimal Reproduction
npm install -g @angular/cli@latest
npm install -g npm@latest
ng new some-app
Step 3 crashes with the below error message.
🔥 Exception or Error
🌍 Your Environment
The text was updated successfully, but these errors were encountered: