Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

× Migration failed: Cannot convert undefined or null to object #26337

Closed
1 task
kibetmasi opened this issue Nov 12, 2023 · 6 comments · Fixed by #26364
Closed
1 task

× Migration failed: Cannot convert undefined or null to object #26337

kibetmasi opened this issue Nov 12, 2023 · 6 comments · Fixed by #26364
Labels
area: @angular/cli needs: investigation Requires some digging to determine if action is needed ng update DX

Comments

@kibetmasi
Copy link

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

@alan-agius4 alan-agius4 added needs: more info Reporter must clarify the issue needs: investigation Requires some digging to determine if action is needed area: @angular/cli ng update DX and removed needs: more info Reporter must clarify the issue labels Nov 13, 2023
@alan-agius4
Copy link
Collaborator

The problem seems to happen as pesapalschema is a private package. Are you using an NPM RC to config NPM to use a private registry?

@kibetmasi
Copy link
Author

I'm not currently using a private registry or an NPM RC file in my project

@kibetmasi
Copy link
Author

kibetmasi commented Nov 15, 2023

is there anything else you'd like me to provide information on? I can share my repo if necessary, currently it's private

@alan-agius4
Copy link
Collaborator

So how are you installing pesapalschema which is not in the public NPM registry?

@KibetMasiror
Copy link

It is in a public registry
Here's the link: https://www.npmjs.com/package/ngx-pesapal

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 15, 2023
In some cases pacote will return undefined as `version` which resulted in `Cannot convert undefined or null to object`.

Closes angular#26337
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 15, 2023
In some cases pacote will return undefined as `version` which resulted in `Cannot convert undefined or null to object`.

Closes angular#26337
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Nov 15, 2023
In some cases pacote will return undefined as `version` which resulted in `Cannot convert undefined or null to object`.

Closes angular#26337
alan-agius4 added a commit that referenced this issue Nov 15, 2023
In some cases pacote will return undefined as `version` which resulted in `Cannot convert undefined or null to object`.

Closes #26337
alan-agius4 added a commit that referenced this issue Nov 15, 2023
In some cases pacote will return undefined as `version` which resulted in `Cannot convert undefined or null to object`.

Closes #26337

(cherry picked from commit bec9458)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli needs: investigation Requires some digging to determine if action is needed ng update DX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants