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
Can you please try to run the below?
ng update @angular/cli@9 @angular/core@9
hi I get the following
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 83 dependencies.
Fetching dependency metadata from registry...
Package '@angular/cli' is already up to date.
Package '@angular/core' is already up to date.
I have tried clearing npm cache, deleing node_modules, tried a different computer, skipping cli migration from 8-9 and tried running 9-10 but same issue,
looking at the file with the error "Loose" is a property of an enum so not sure why it is undefined
What is the version of your global Angular CLI?, is it also version 9?
Angular CLI: 13.0.1 Node: 14.18.1 Package Manager: npm 6.14.15 OS: win32 x64
I think I will just create an angular 12/13 project and port over my logic and pages. I wanted to do an UI upgrade anyway
thanx for the willingness to help
So using a global CLI version which is greater that the targeted version might be problematic. I suggest you install the same version globally.
Can you try the below?
npm i @angular/cli@9 -g
ng update @angular/cli --from 8 --to 9 --migrate-only
It doesn't help. I'm facing the same issue.
In file node_modules\@schematics\angular\migrations\update-9\utils.js is code:
const core_1 = require("@angular-devkit/core");
When I run it by ng update @angular/cli --from 8 --to 9 --migrate-only core_1 is:
{
analytics: {
NgCliAnalyticsDimensions: {
'1': 'CpuCount',
'2': 'CpuSpeed',
'3': 'RamInGigabytes',
'4': 'NodeVersion',
'6': 'NgAddCollection',
'8': 'AotEnabled',
'20': 'BuildErrors',
CpuCount: 1,
CpuSpeed: 2,
RamInGigabytes: 3,
NodeVersion: 4,
NgAddCollection: 6,
AotEnabled: 8,
BuildErrors: 20
},
NgCliAnalyticsMetrics: {
'1': 'NgComponentCount',
'2': 'UNUSED_2',
'3': 'UNUSED_3',
'4': 'UNUSED_4',
'5': 'BuildTime',
'6': 'NgOnInitCount',
'7': 'InitialChunkSize',
'8': 'TotalChunkCount',
'9': 'TotalChunkSize',
'10': 'LazyChunkCount',
'11': 'LazyChunkSize',
'12': 'AssetCount',
'13': 'AssetSize',
'14': 'PolyfillSize',
'15': 'CssSize',
NgComponentCount: 1,
UNUSED_2: 2,
UNUSED_3: 3,
UNUSED_4: 4,
BuildTime: 5,
NgOnInitCount: 6,
InitialChunkSize: 7,
TotalChunkCount: 8,
TotalChunkSize: 9,
LazyChunkCount: 10,
LazyChunkSize: 11,
AssetCount: 12,
AssetSize: 13,
PolyfillSize: 14,
CssSize: 15
},
NgCliAnalyticsDimensionsFlagInfo: {
CpuCount: [Array],
CpuSpeed: [Array],
RamInGigabytes: [Array],
NodeVersion: [Array],
NgAddCollection: [Array],
AotEnabled: [Array],
BuildErrors: [Array]
},
NgCliAnalyticsMetricsFlagInfo: {
NgComponentCount: [Array],
UNUSED_2: [Array],
UNUSED_3: [Array],
UNUSED_4: [Array],
BuildTime: [Array],
NgOnInitCount: [Array],
InitialChunkSize: [Array],
TotalChunkCount: [Array],
TotalChunkSize: [Array],
LazyChunkCount: [Array],
LazyChunkSize: [Array],
AssetCount: [Array],
AssetSize: [Array],
PolyfillSize: [Array],
CssSize: [Array]
},
AnalyticsReportKind: [Getter],
ForwardingAnalytics: [Getter],
AnalyticsReporter: [Getter],
LoggingAnalytics: [Getter],
MultiAnalytics: [Getter],
NoopAnalytics: [Getter]
},
experimental: {
jobs: {
JobInboundMessageKind: [Getter],
JobOutboundMessageKind: [Getter],
JobState: [Getter],
isJobHandler: [Getter],
ChannelAlreadyExistException: [Getter],
createJobHandler: [Getter],
createJobFactory: [Getter],
createLoggerJob: [Getter],
JobNameAlreadyRegisteredException: [Getter],
JobDoesNotExistException: [Getter],
createDispatcher: [Getter],
FallbackRegistry: [Getter],
SimpleJobRegistry: [Getter],
JobArgumentSchemaValidationError: [Getter],
JobInboundMessageSchemaValidationError: [Getter],
JobOutputSchemaValidationError: [Getter],
SimpleScheduler: [Getter],
strategy: [Getter]
}
},
json: {
schema: {
transforms: [Object],
buildJsonPointer: [Getter],
joinJsonPointer: [Getter],
parseJsonPointer: [Getter],
SchemaValidationException: [Getter],
CoreSchemaRegistry: [Getter],
isJsonSchema: [Getter],
mergeSchemas: [Getter],
visitJson: [Getter],
visitJsonSchema: [Getter],
getTypesOfSchema: [Getter]
},
isJsonObject: [Getter],
isJsonArray: [Getter]
},
logging: {
IndentLogger: [Getter],
LevelTransformLogger: [Getter],
LevelCapLogger: [Getter],
Logger: [Getter],
NullLogger: [Getter],
TransformLogger: [Getter]
},
workspaces: {
createWorkspaceHost: [Getter],
WorkspaceFormat: [Getter],
readWorkspace: [Getter],
writeWorkspace: [Getter],
ProjectDefinitionCollection: [Getter],
TargetDefinitionCollection: [Getter]
},
BaseException: [Getter],
UnknownException: [Getter],
FileDoesNotExistException: [Getter],
FileAlreadyExistException: [Getter],
PathIsDirectoryException: [Getter],
PathIsFileException: [Getter],
ContentHasMutatedException: [Getter],
InvalidUpdateRecordException: [Getter],
MergeConflictException: [Getter],
UnimplementedException: [Getter],
UnsupportedPlatformException: [Getter],
schema: [Getter],
isJsonObject: [Getter],
isJsonArray: [Getter],
tags: [Getter],
strings: [Getter],
clean: [Getter],
mapObject: [Getter],
deepCopy: [Getter],
templateParser: [Getter],
template: [Getter],
DependencyNotFoundException: [Getter],
CircularDependencyFoundException: [Getter],
PartiallyOrderedSet: [Getter],
PriorityQueue: [Getter],
isPromise: [Getter],
virtualFs: [Getter],
InvalidPathException: [Getter],
PathMustBeAbsoluteException: [Getter],
PathCannotBeFragmentException: [Getter],
NormalizedSep: [Getter],
NormalizedRoot: [Getter],
split: [Getter],
extname: [Getter],
basename: [Getter],
dirname: [Getter],
join: [Getter],
isAbsolute: [Getter],
relative: [Getter],
resolve: [Getter],
fragment: [Getter],
resetNormalizeCache: [Getter],
normalize: [Getter],
noCacheNormalize: [Getter],
path: [Getter],
asWindowsPath: [Getter],
asPosixPath: [Getter],
getSystemPath: [Getter]
}
I create my own file in main directory which content:
const core_1 = require("@angular-devkit/core")
console.log(core_1);
It produces:
{
analytics: {
AnalyticsReportKind: {
Event: 'event',
Screenview: 'screenview',
Pageview: 'pageview',
Timing: 'timing'
},
ForwardingAnalytics: [class ForwardingAnalytics],
AnalyticsReporter: [class AnalyticsReporter],
LoggingAnalytics: [class LoggingAnalytics],
MultiAnalytics: [class MultiAnalytics],
NoopAnalytics: [class NoopAnalytics],
NgCliAnalyticsDimensions: {
'1': 'CpuCount',
'2': 'CpuSpeed',
'3': 'RamInGigabytes',
'4': 'NodeVersion',
'6': 'NgAddCollection',
'7': 'NgBuildBuildEventLog',
'8': 'NgIvyEnabled',
'20': 'BuildErrors',
CpuCount: 1,
CpuSpeed: 2,
RamInGigabytes: 3,
NodeVersion: 4,
NgAddCollection: 6,
NgBuildBuildEventLog: 7,
NgIvyEnabled: 8,
BuildErrors: 20
},
NgCliAnalyticsMetrics: {
'1': 'NgComponentCount',
'2': 'UNUSED_2',
'3': 'UNUSED_3',
'4': 'UNUSED_4',
'5': 'BuildTime',
'6': 'NgOnInitCount',
'7': 'InitialChunkSize',
'8': 'TotalChunkCount',
'9': 'TotalChunkSize',
'10': 'LazyChunkCount',
'11': 'LazyChunkSize',
'12': 'AssetCount',
'13': 'AssetSize',
'14': 'PolyfillSize',
'15': 'CssSize',
NgComponentCount: 1,
UNUSED_2: 2,
UNUSED_3: 3,
UNUSED_4: 4,
BuildTime: 5,
NgOnInitCount: 6,
InitialChunkSize: 7,
TotalChunkCount: 8,
TotalChunkSize: 9,
LazyChunkCount: 10,
LazyChunkSize: 11,
AssetCount: 12,
AssetSize: 13,
PolyfillSize: 14,
CssSize: 15
},
NgCliAnalyticsDimensionsFlagInfo: {
CpuCount: [Array],
CpuSpeed: [Array],
RamInGigabytes: [Array],
NodeVersion: [Array],
NgAddCollection: [Array],
NgBuildBuildEventLog: [Array],
NgIvyEnabled: [Array],
BuildErrors: [Array]
},
NgCliAnalyticsMetricsFlagInfo: {
NgComponentCount: [Array],
UNUSED_2: [Array],
UNUSED_3: [Array],
UNUSED_4: [Array],
BuildTime: [Array],
NgOnInitCount: [Array],
InitialChunkSize: [Array],
TotalChunkCount: [Array],
TotalChunkSize: [Array],
LazyChunkCount: [Array],
LazyChunkSize: [Array],
AssetCount: [Array],
AssetSize: [Array],
PolyfillSize: [Array],
CssSize: [Array]
}
},
experimental: {
jobs: {
JobInboundMessageKind: [Object],
JobOutboundMessageKind: [Object],
JobState: [Object],
isJobHandler: [Function: isJobHandler],
ChannelAlreadyExistException: [class ChannelAlreadyExistException extends BaseException],
createJobHandler: [Function: createJobHandler],
createJobFactory: [Function: createJobFactory],
createLoggerJob: [Function: createLoggerJob],
JobNameAlreadyRegisteredException: [class JobNameAlreadyRegisteredException extends BaseException],
JobDoesNotExistException: [class JobDoesNotExistException extends BaseException],
createDispatcher: [Function: createDispatcher],
FallbackRegistry: [class FallbackRegistry],
SimpleJobRegistry: [class SimpleJobRegistry],
JobArgumentSchemaValidationError: [class JobArgumentSchemaValidationError extends SchemaValidationException],
JobInboundMessageSchemaValidationError: [class JobInboundMessageSchemaValidationError extends SchemaValidationException],
JobOutputSchemaValidationError: [class JobOutputSchemaValidationError extends SchemaValidationException],
SimpleScheduler: [class SimpleScheduler],
strategy: [Object]
},
workspace: {
WorkspaceFileNotFoundException: [class WorkspaceFileNotFoundException extends BaseException],
ProjectNotFoundException: [class ProjectNotFoundException extends BaseException],
WorkspaceToolNotFoundException: [class WorkspaceToolNotFoundException extends BaseException],
ProjectToolNotFoundException: [class ProjectToolNotFoundException extends BaseException],
WorkspaceNotYetLoadedException: [class WorkspaceNotYetLoadedException extends BaseException],
AmbiguousProjectPathException: [class AmbiguousProjectPathException extends BaseException],
Workspace: [Function]
}
},
json: {
isJsonObject: [Function: isJsonObject],
isJsonArray: [Function: isJsonArray],
JsonException: [class JsonException extends BaseException],
InvalidJsonCharacterException: [class InvalidJsonCharacterException extends JsonException],
UnexpectedEndOfInputException: [class UnexpectedEndOfInputException extends JsonException],
PathSpecificJsonException: [class PathSpecificJsonException extends JsonException],
JsonParseMode: {
'0': 'Json',
'1': 'CommentsAllowed',
'2': 'SingleQuotesAllowed',
'4': 'IdentifierKeyNamesAllowed',
'8': 'TrailingCommasAllowed',
'16': 'HexadecimalNumberAllowed',
'32': 'MultiLineStringAllowed',
'64': 'LaxNumberParsingAllowed',
'128': 'NumberConstantsAllowed',
'255': 'Json5',
Strict: 0,
CommentsAllowed: 1,
SingleQuotesAllowed: 2,
IdentifierKeyNamesAllowed: 4,
TrailingCommasAllowed: 8,
HexadecimalNumberAllowed: 16,
MultiLineStringAllowed: 32,
LaxNumberParsingAllowed: 64,
NumberConstantsAllowed: 128,
Default: 0,
Loose: 255,
Json: 0,
Json5: 255
},
parseJsonAst: [Function: parseJsonAst],
parseJson: [Function: parseJson],
schema: {
buildJsonPointer: [Function: buildJsonPointer],
joinJsonPointer: [Function: joinJsonPointer],
parseJsonPointer: [Function: parseJsonPointer],
SchemaValidationException: [class SchemaValidationException extends BaseException],
CoreSchemaRegistry: [class CoreSchemaRegistry],
isJsonSchema: [Function: isJsonSchema],
mergeSchemas: [Function: mergeSchemas],
visitJson: [Function: visitJson],
visitJsonSchema: [Function: visitJsonSchema],
getTypesOfSchema: [Function: getTypesOfSchema],
transforms: [Object]
}
},
logging: {
IndentLogger: [class IndentLogger extends Logger],
LevelTransformLogger: [class LevelTransformLogger extends Logger],
LevelCapLogger: [class LevelCapLogger extends LevelTransformLogger] {
levelMap: [Object]
},
Logger: [class Logger extends Observable],
NullLogger: [class NullLogger extends Logger],
TransformLogger: [class TransformLogger extends Logger]
},
workspaces: {
ProjectDefinitionCollection: [class ProjectDefinitionCollection extends DefinitionCollection],
TargetDefinitionCollection: [class TargetDefinitionCollection extends DefinitionCollection],
createWorkspaceHost: [Function: createWorkspaceHost],
WorkspaceFormat: { '0': 'JSON', JSON: 0 },
readWorkspace: [AsyncFunction: readWorkspace],
writeWorkspace: [AsyncFunction: writeWorkspace]
},
BaseException: [class BaseException extends Error],
UnknownException: [class UnknownException extends BaseException],
FileDoesNotExistException: [class FileDoesNotExistException extends BaseException],
FileAlreadyExistException: [class FileAlreadyExistException extends BaseException],
PathIsDirectoryException: [class PathIsDirectoryException extends BaseException],
PathIsFileException: [class PathIsFileException extends BaseException],
ContentHasMutatedException: [class ContentHasMutatedException extends BaseException],
InvalidUpdateRecordException: [class InvalidUpdateRecordException extends BaseException],
MergeConflictException: [class MergeConflictException extends BaseException],
UnimplementedException: [class UnimplementedException extends BaseException],
UnsupportedPlatformException: [class UnsupportedPlatformException extends BaseException],
isJsonObject: [Function: isJsonObject],
isJsonArray: [Function: isJsonArray],
JsonException: [class JsonException extends BaseException],
InvalidJsonCharacterException: [class InvalidJsonCharacterException extends JsonException],
UnexpectedEndOfInputException: [class UnexpectedEndOfInputException extends JsonException],
PathSpecificJsonException: [class PathSpecificJsonException extends JsonException],
JsonParseMode: {
'0': 'Json',
'1': 'CommentsAllowed',
'2': 'SingleQuotesAllowed',
'4': 'IdentifierKeyNamesAllowed',
'8': 'TrailingCommasAllowed',
'16': 'HexadecimalNumberAllowed',
'32': 'MultiLineStringAllowed',
'64': 'LaxNumberParsingAllowed',
'128': 'NumberConstantsAllowed',
'255': 'Json5',
Strict: 0,
CommentsAllowed: 1,
SingleQuotesAllowed: 2,
IdentifierKeyNamesAllowed: 4,
TrailingCommasAllowed: 8,
HexadecimalNumberAllowed: 16,
MultiLineStringAllowed: 32,
LaxNumberParsingAllowed: 64,
NumberConstantsAllowed: 128,
Default: 0,
Loose: 255,
Json: 0,
Json5: 255
},
parseJsonAst: [Function: parseJsonAst],
parseJson: [Function: parseJson],
schema: {
buildJsonPointer: [Function: buildJsonPointer],
joinJsonPointer: [Function: joinJsonPointer],
parseJsonPointer: [Function: parseJsonPointer],
SchemaValidationException: [class SchemaValidationException extends BaseException],
CoreSchemaRegistry: [class CoreSchemaRegistry],
isJsonSchema: [Function: isJsonSchema],
mergeSchemas: [Function: mergeSchemas],
visitJson: [Function: visitJson],
visitJsonSchema: [Function: visitJsonSchema],
getTypesOfSchema: [Function: getTypesOfSchema],
transforms: { addUndefinedDefaults: [Function: addUndefinedDefaults] }
},
tags: {
oneLine: [Function: oneLine],
indentBy: [Function: indentBy],
stripIndent: [Function: stripIndent],
stripIndents: [Function: stripIndents],
trimNewlines: [Function: trimNewlines]
},
strings: {
decamelize: [Function: decamelize],
dasherize: [Function: dasherize],
camelize: [Function: camelize],
classify: [Function: classify],
underscore: [Function: underscore],
capitalize: [Function: capitalize],
levenshtein: [Function: levenshtein]
},
clean: [Function: clean],
mapObject: [Function: mapObject],
deepCopy: [Function: deepCopy],
templateParser: [Function: templateParser],
template: [Function: template],
DependencyNotFoundException: [class DependencyNotFoundException extends BaseException],
CircularDependencyFoundException: [class CircularDependencyFoundException extends BaseException],
PartiallyOrderedSet: [class PartiallyOrderedSet],
PriorityQueue: [class PriorityQueue],
isPromise: [Function: isPromise],
isObservable: [Function: isObservable],
InvalidPathException: [class InvalidPathException extends BaseException],
PathMustBeAbsoluteException: [class PathMustBeAbsoluteException extends BaseException],
PathCannotBeFragmentException: [class PathCannotBeFragmentException extends BaseException],
NormalizedSep: '/',
NormalizedRoot: '/',
split: [Function: split],
extname: [Function: extname],
basename: [Function: basename],
dirname: [Function: dirname],
join: [Function: join],
isAbsolute: [Function: isAbsolute],
relative: [Function: relative],
resolve: [Function: resolve],
fragment: [Function: fragment],
resetNormalizeCache: [Function: resetNormalizeCache],
normalize: [Function: normalize],
noCacheNormalize: [Function: noCacheNormalize],
path: [Function],
asWindowsPath: [Function: asWindowsPath],
asPosixPath: [Function: asPosixPath],
getSystemPath: [Function: getSystemPath],
virtualFs: {
AliasHost: [class AliasHost extends ResolverHost],
stringToFileBuffer: [Function: stringToFileBuffer],
fileBuffer: [Function],
fileBufferToString: [Function: fileBufferToString],
Empty: [class Empty],
SimpleMemoryHost: [class SimpleMemoryHost],
PatternMatchingHost: [class PatternMatchingHost extends ResolverHost],
CordHost: [class CordHost extends SimpleMemoryHost],
SafeReadonlyHost: [class SafeReadonlyHost],
ScopedHost: [class ScopedHost extends ResolverHost],
SynchronousDelegateExpectedException: [class SynchronousDelegateExpectedException extends BaseException],
SyncDelegateHost: [class SyncDelegateHost],
ResolverHost: [class ResolverHost],
test: { TestHost: [class TestHost extends SimpleMemoryHost] }
},
terminal: {
reset: [Function],
bold: [Function],
dim: [Function],
italic: [Function],
underline: [Function],
inverse: [Function],
hidden: [Function],
strikethrough: [Function],
black: [Function],
red: [Function],
green: [Function],
yellow: [Function],
blue: [Function],
magenta: [Function],
cyan: [Function],
white: [Function],
grey: [Function],
gray: [Function],
bgBlack: [Function],
bgRed: [Function],
bgGreen: [Function],
bgYellow: [Function],
bgBlue: [Function],
bgMagenta: [Function],
bgCyan: [Function],
bgWhite: [Function],
getCapabilities: [Function: getCapabilities],
colors: {
reset: [Function],
bold: [Function],
dim: [Function],
italic: [Function],
underline: [Function],
inverse: [Function],
hidden: [Function],
strikethrough: [Function],
black: [Function],
red: [Function],
green: [Function],
yellow: [Function],
blue: [Function],
magenta: [Function],
cyan: [Function],
white: [Function],
grey: [Function],
gray: [Function],
bgBlack: [Function],
bgRed: [Function],
bgGreen: [Function],
bgYellow: [Function],
bgBlue: [Function],
bgMagenta: [Function],
bgCyan: [Function],
bgWhite: [Function]
}
}
}
JsonParseMode is present in second structure, but is not in the first one. I don't know why. I work on the same version of @angular-devkit/core package.
I discovered that when I run ng update @angular/cli --from 8 --to 9 --migrate-only in /tmp is being created temporary directory angular-cli-packages-******* which includes package.json:
{"name":"temp-cli-install","description":"temp-cli-install","repository":"temp-cli-install","license":"MIT"}
and direcotry node_modules. There is added package @angular-devkit/core in "version": "13.0.1"
As I understand the newest version of @angular-devkit/core is not compatible with migration instructions from @schematics/angular/migrations/update-9
I was able to replicate this issue. As a workaround you can use the following command.
NG_DISABLE_VERSION_CHECK=1 ./node_modules/.bin/ng update @angular/cli --from 8 --to 9 --migrate-only
How to use it when I run ng update @angular/cli without --migrate-only ? In the same way ?
Yes
This solution is not working for me:

Please, there's another solution for this?
I also faced this issue, and have tried all the solutions as the above mentioned.
Migrate Angular 8 to 9

Any other solutions? Thanks
Facing same issue. Any help for fixing it will be much helpful

NG_DISABLE_VERSION_CHECK=1 ./node_modules/.bin/ng update @angular/cli --from 8 --to 9 --migrate-only
I think it works on a linux terminal and i do not know how it can be executed on Windows.
As really dirty workaround edit the ./node_modules/.bin/ng.cmd file and put SET NG_DISABLE_VERSION_CHECK=1 in the first lines of the file (i.e. after SETLOCAL).
Then run ./node_modules/.bin/ng.cmd update @angular/cli.cmd --from 8 --to 9 --migrate-only
Notice that it happens also for migration between 9 and 10.
@snarchio I tried your solution, but not work for me, also with the same error.
To be more clear. As i understand when you try to do an update, Angular uses everytime the latest version of cli. This is the reason why in your logs you notice Installing a temporary version to perform the update before the two green lines. Unfortunately the last cli version is not compatible with the migration scripts from 8 to 9 so the error on ...Loose....
So, to fix, the path will be:
npx @angular/cli@9 update @angular/core@9 @angular/cli@9as stated in the migration guide. This will update your package list and downloads the new cli@9 and migrations script. But if fails on migrations script because it is using the latest cli (at the moment i think cli@13).- At this point change
./node_modules/.bin/ng.cmdas stated in my previous response and perform only the migrations, not the entire proces.
Thanks @snarchio for quick response.
I executed above step, but it not working. Any help on next step?

Finally i am able to upgrade to v9. But when I run ng build --prod got below error.
`ERROR in node_modules/protractor/built/index.d.ts:5:10 - error TS2440: Import declaration conflicts with local declaration of 'PluginConfig'.
5 import { PluginConfig, ProtractorPlugin } from './plugins'; ~~~~~~~~~~~~ node_modules/protractor/built/index.d.ts:5:24 - error TS2440: Import declaration conflicts with local declaration of 'ProtractorPlugin'.
5 import { PluginConfig, ProtractorPlugin } from './plugins';`
Any idea to fix the issue?