ng update migration 'Remove Browserslist configuration files that matches the Angular CLI default configuration.' fails with non-descript error when #24991
Labels
area: @schematics/angular
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
update
Is this a regression?
The previous version in which this bug was not present was
No response
Description
The ng update from version 14 to 15 migration fails with the following nondescript error if you have a node_modules "backup", for example
node_modules2
, folder in the project directoryThis is technically "my fault", but it would be nice if we had a better description of what is going on, I had to add a bunch of logs to the cli code to figure out where and what made it fail.
Here is the specific error:
Minimal Reproduction
Arrange your directories in the following fashion:
├───angular-root-directory
│ ├───node_modules
│ ├───node_modules2
│ ├───src
│ ├───package.json
│ ├───angular.json
│ ├───tsconfig.json
And run the
@angular/cli
migrations with a command equivalent to this one:ng update @angular/cli --from 14 --to 15 --migrate-only --allow-dirty --force
The node_modules2 directory must have the npm packages too.
The specific cause of the "crash" is the presence of the browserslist file in
/node_modules2/.bin/
because line 80 of@schematics\angular\migrations\update-15\remove-browserslist-config.js
tries to parse the source of the browserslist executableHere is "my" line 80:
const { defaults: browsersListConfig, ...otherConfigs } = browserslist.parseConfig(tree.readText(path));
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: