Migration failed: Cannot read property 'Loose' of undefined
See original GitHub issueπ 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:32
Top Results From Across the Web
Migration failed: Cannot read property 'Loose' of undefined
/11/04 Migration failed: Cannot read property 'Loose' of undefined # Closed. I got a problem while building a test demo, it said "Module...
Read more >Cannot read property 'loose' of undefined babel 7 - Menubar
This error message is associated with Babel7. The cause of the error is mixing Babel 6 and Babel 7. Babel 7 is incompatible...
Read more >angular - Cannot read properties of undefined (reading 'kind')
As you can see, angular is trying to read property "kind" from some other value. So perhaps somewhere in your code, you have...
Read more >Angular 12 Support #14909 - Issuehunt
Could not get angular cli webpack config ERR! TypeError: Cannot read property 'minify' of undefined ERR! at getCommonConfigΒ ...
Read more >Babel - Storybook
Storybook's frameworks and addons may provide minor programmatic modifications to the babel configuration. How it works. To activate V7 mode, set the featureΒ ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 runupdate
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.
node_modules
andpackage-lock.json
file if required and do a freshnpm install
)@angular/cli
version in your local (in this case runnpm install -D @angular/cli@9
)npx ng update @angular/core@9 @angular/cli@9
- you might need to use--force
and--allow-dirty
based on your project)This should migrate your application successfully to the target version.
(My Node Version
v12.20.1
, NPM is6.13.4
, Global ng version is8.3.25
)I was able to replicate this issue. As a workaround you can use the following command.