Migration failed: Cannot read property 'Loose' of undefined
🐞 Bug report
Command (mark with an x)
ng update @angular/cli --from 8 --to 9 --migrate-only
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ x] update
- [ ] lint
- [ ] extract-i18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was: Migrating from angular 7 to 8
Description
** Executing migrations of package '@angular/cli' **
Replace deprecated 'styleext' and 'spec' Angular schematic options. × Migration failed: Cannot read property 'Loose' of undefined
🔬 Minimal Reproduction
I can only reproduce it on this one project I've upgraded another angular project without any issues
🔥 Exception or Error
[error] TypeError: Cannot read property 'Loose' of undefined
at readJsonFileAsAstObject (~\node_modules\@angular\cli\node_modules\@schematics\angular\migrations\update-9\utils.js:90:74)
at Object.getWorkspace (~\node_modules\@angular\cli\node_modules\@schematics\angular\migrations\update-9\utils.js:77:21)
at ~\node_modules\@angular\cli\node_modules\@schematics\angular\migrations\update-9\schematic-options.js:15:35
at MergeMapSubscriber.project ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\rules\call.js:75:24)
at MergeMapSubscriber._tryNext ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:67:27)
at MergeMapSubscriber._next ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:57:18)
at MergeMapSubscriber.Subscriber.next ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:66:18)
at Observable._subscribe ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeToArray.js:5:20)
at Observable._trySubscribe ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:44:25)
at Observable.subscribe ({userDir}\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:30:22)
🌍 Your Environment
Angular CLI: 10.2.3
Node: 14.18.1
OS: win32 x64
Angular: 10.2.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.13.10
@angular-devkit/build-angular 0.1002.3
@angular-devkit/core 7.3.10
@angular-devkit/schematics 10.2.3
@angular/cdk 10.2.7
@angular/cli 10.2.3
@angular/material 10.2.7
@angular/material-moment-adapter 10.2.7
@schematics/angular 7.3.10
@schematics/update 0.13.10
rxjs 7.4.0
typescript 3.9.10
@SridharSunke i stuck with package is not install what was the next step to solve can plz let us know Thank you
I worked around this by basically just ignoring it. After the error I just ran npm i and proceeded. I was updating from 7 to 13 but once I reached version 11 the errors stopped.
** Executing migrations of package '@angular/cli' **
❯ Update an Angular CLI project to version 9. ✖ Migration failed: Cannot read property 'Loose' of undefined See "/private/var/folders/zm/v6yzjyc931n8kcxjvjqw_bp40000gn/T/ng-Aa301D/angular-errors.log" for further details.
I also met, can anyone help me
@yrang I have the same errors.
Node version: v14.17.0 Npm Version: 6.14.13 Global Angular CLI: 9.1.15 Project Angular CLI: 10.2.3
I have the same error
My Node version: 14.17.3 My Nm Version: 6.14.13 My Global Ng Version: 8.3.29 My Project CLi version: 8.3.29
Do we need to have any specific node, npm or ng versions to resolve this issue ?
Hi, I think when you run npx @angular/cli@9 update @angular/core@9 @angular/cli@9, it supposes to install the @angular/cli@9 in your local node_modules and run update command against that version. For some reason it is not happening as expected.
These are the steps that I followed and I was able to migrate Angular 8 application to Angular 9 without any errors.
- Make sure your project is clean (delete
node_modulesandpackage-lock.jsonfile if required and do a freshnpm install) - Install target
@angular/cliversion in your local (in this case runnpm install -D @angular/cli@9) - Now run update command against the local cli (
npx ng update @angular/core@9 @angular/cli@9- you might need to use--forceand--allow-dirtybased on your project)
This should migrate your application successfully to the target version.
(My Node Version v12.20.1, NPM is 6.13.4, Global ng version is 8.3.25 )
Hi,
I am facing the exact same issue.
I have other Angular projects that I've been migrating without this kind of problem.
I can't ignore the error because the migration process is not valid (there are no changes in the code whereas between 8 and 9 there should be)
None of the above solutions worked...
npm 6.14.14 node v14.16.1 Global Angular CLI 9.1.15 Project Angular CLI 9.1.13
I worked around this by basically just ignoring it. After the error I just ran
npm iand proceeded. I was updating from 7 to 13 but once I reached version 11 the errors stopped.
This worked for me as well. I was going from 9 to 13, and the errors stopped after 11.
I am running into this issue with a fresh install of the CLI while using schematics manually:
ng generate reducer Session --reducers reducers/index.ts
I have the following output:
? Should we add success and failure actions to the reducer? No
? Do you want to use the create function? Yes
Cannot read property 'Loose' of undefined
Is this related?
@Rybadour, no that seems to be an issue with NGRX schematics.
Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases.
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.