-
Notifications
You must be signed in to change notification settings - Fork 11.9k
× Migration failed: Cannot convert undefined or null to object #26337
Copy link
Copy link
Closed
Labels
area: @angular/clineeds: investigationRequires some digging to determine if action is neededRequires some digging to determine if action is neededng update DX
Description
Command
update
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Trying to update an Angular project (library and schematics) to angular V17 using the command ng update.
However, I'm receiving the error below:
Using package manager: npm
Collecting installed dependencies...
Found 26 dependencies.
× Migration failed: Cannot convert undefined or null to object
See "C:\Users\Mercy\AppData\Local\Temp\ng-RsET9k\angular-errors.log" for further details.
Minimal Reproduction
Root package.json file:
{
"name": "pv2",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular-devkit/schematics": "^16.2.9",
"@angular/animations": "^16.0.0",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/forms": "^16.0.0",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
"pesapalschema": "^0.0.5",
"rxjs": "~7.8.0",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.0.1",
"@angular/cli": "~16.2.9",
"@angular/compiler-cli": "^16.0.0",
"@types/jasmine": "~4.3.0",
"copyfiles": "^2.4.1",
"jasmine-core": "~4.6.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"ng-packagr": "^16.0.0",
"tslib": "^2.6.2",
"typescript": "~5.0.2"
}
}
angular.json file:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"pv2": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/pv2",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "pv2:build:production"
},
"development": {
"browserTarget": "pv2:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "pv2:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
}
}
},
"pesapal": {
"projectType": "library",
"root": "projects/pesapal",
"sourceRoot": "projects/pesapal/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/pesapal/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/pesapal/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/pesapal/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/pesapal/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
}
}
}
tsconfig.json file:
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"paths": {
"pesapal": [
"dist/pesapal"
]
},
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": [
"ES2022",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
Exception or Error
[error] TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at _buildPackageInfo (C:\Users\Mercy\OneDrive\Desktop\projects\pv2\node_modules\@angular\cli\src\commands\update\schematic\index.js:433:52)
at C:\Users\Mercy\OneDrive\Desktop\projects\pv2\node_modules\@angular\cli\src\commands\update\schematic\index.js:707:53
at Map.forEach (<anonymous>)
at C:\Users\Mercy\OneDrive\Desktop\projects\pv2\node_modules\@angular\cli\src\commands\update\schematic\index.js:706:27
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async callRuleAsync (C:\Users\Mercy\OneDrive\Desktop\projects\pv2\node_modules\@angular-devkit\schematics\src\rules\call.js:77:18)
Your Environment
Angular CLI: 16.2.9
Node: 18.16.0
Package Manager: npm 9.6.6
OS: win32 x64
Angular: 16.2.11
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1602.9
@angular-devkit/build-angular 16.2.9
@angular-devkit/core 16.2.9
@angular-devkit/schematics 16.2.9
@angular/cli 16.2.9
@schematics/angular 16.2.9
ng-packagr 16.2.3
rxjs 7.8.1
typescript 5.0.4
zone.js 0.13.3
Anything else relevant?
Package Manager used: npm
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @angular/clineeds: investigationRequires some digging to determine if action is neededRequires some digging to determine if action is neededng update DX