Repository navigation
ng update deletes node_modules before ensuring it will succeed聽#22162
Copy link
Copy link
Closed
Labels
area: @angular/clifreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyng update DXseverity2: inconvenienttype: bug/fix
Milestone
Description
馃悶 Bug report
Command (mark with an x)
ng update @angular/cli @angular/cdk ...
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Not sure. Might be half bug, half feature request.
Description
When updating from angular 12 to 13, the following sequence of events happened:
ng updateto determine dependenciesng update ...- after determining dependencies and updating my package.json file, the script seems to delete node_modules
- the
npm installstep triggered byng updatefails due to a peer dependency conflict - this is the FR/bug this part of the script should do a dry run and abort before deleting
node_modulesif thenpm installwith the updated package.json file will fail. Ideally add more details and suggestions here, and roll back the change topackage.json. - Now re-running
ng updatea second time will note no installed dependencies, because apparently the script checksnode_modulesand notpackage.json. - The actual fix for the deeper bug is some conflict in peer dependencies between the older 12 installation of architect and build-angular and the updated
package.jsonfile. Revertingpackage.jsonto head (the 12 installation), runningnpm installto re-install the now-missingnode_modulesdirectory, then deletingpackage-lock.json, will allow theng updatecommand to run to completion. If this is a common issue, adding some help text in that regard would be nice.
馃實 Your Environment
NOTE this is post-upgrade, the bug happened during a 12->13 upgrade.
Angular CLI: 13.0.2
Node: 16.10.0
Package Manager: npm 7.24.0
OS: linux x64
Angular: 13.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.2
@angular-devkit/build-angular 13.0.2
@angular-devkit/core 13.0.2
@angular-devkit/schematics 13.0.2
@angular/cli 13.0.2
@angular/fire 7.2.0
@schematics/angular 13.0.2
rxjs 6.6.7
typescript 4.4.4
Anything else relevant?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @angular/clifreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyng update DXseverity2: inconvenienttype: bug/fix
Activity
ardunster commentedon Nov 19, 2021
I had an issue with this also, didn't think of rerunning update after deleting the contents of package.json, I ended up copying them to another location and installing them a few at a time with the new version. Something involving
@angular-devkit/build-angularhas a bad peer dependency listed. I thought I had a log file to share but it inadvertently got overwritten.asteidle70 commentedon Dec 2, 2021
Same issue with update from Angular 10 to 11. node_modules folder gone! :( :(
From
https://update.angular.io/?l=2&v=10.0-12.0npx @angular/cli@11 update @angular/core@11 @angular/cli@11Only issues a one-line error message "Repository is not clean. ...". But I am not even using git.
Stackoverflow suggests to add --allow-dirty
It runs with that. I get
npm WARN old lockfile The package-lock.json file was created with an old version of npm,Not sure if that is important.
Then plenty of errors related to
@angular-devkit/build-angular@0.1000.4eresolve-report.txt
Den-dp commentedon Feb 17, 2022
I think that removing a
node_modulesfolder is:package-lock.jsonwhile installing, so removingnode_modulesbrings to us very little or nothing in terms of a profit)nikita-fuchs commentedon Oct 5, 2023
angular-automatic-lock-bot commentedon Aug 20, 2026
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.