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

NG17-RC0: Next8->RC0 changed angular.json #26063

Closed
spock123 opened this issue Oct 19, 2023 · 3 comments · Fixed by #26065
Closed

NG17-RC0: Next8->RC0 changed angular.json #26063

spock123 opened this issue Oct 19, 2023 · 3 comments · Fixed by #26065

Comments

@spock123
Copy link

spock123 commented Oct 19, 2023

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

It looks like going from Next8 -> RC0 broke our development build, as it appears to have modified angular.json, clearing out the serve->configurations values

When starting our application in development mode, we now get the following error:

ng serve --host=0.0.0.0 --port=4000 --configuration=local

Error: Schema validation failed with the following errors:
  Data path "" must have required property 'buildTarget'.
  Data path "" must have required property 'browserTarget'.
  Data path "" must match a schema in anyOf.
/Users/spock/projects/fresto/apps/totti/node_modules/@angular-devkit/architect/node_modules/rxjs/dist/cjs/internal/util/reportUnhandledError.js:13
            throw err;
            ^

SchemaValidationException [Error]: Schema validation failed with the following errors:
  Data path "" must have required property 'buildTarget'.
  Data path "" must have required property 'browserTarget'.
  Data path "" must match a schema in anyOf.
    at /Users/spock/projects/fresto/apps/totti/node_modules/@angular-devkit/architect/src/architect.js:40:27 {
  errors: [
    {
      instancePath: '',
      schemaPath: '#/anyOf/0/required',
      keyword: 'required',
      params: { missingProperty: 'buildTarget' },
      message: "must have required property 'buildTarget'"
    },
    {
      instancePath: '',
      schemaPath: '#/anyOf/1/required',
      keyword: 'required',
      params: { missingProperty: 'browserTarget' },
      message: "must have required property 'browserTarget'"
    },
    {
      instancePath: '',
      schemaPath: '#/anyOf',
      keyword: 'anyOf',
      params: {},
      message: 'must match a schema in anyOf'
    }
  ]
}

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

It's apparently complaining about a syntax issue in angular.json but this has worked in every 17-next-X version. The error only started occurring after upgrading to RC0.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.0.0-next.9
Node: 18.18.1
Package Manager: npm 9.8.1
OS: darwin arm64

Angular: 17.0.0-rc.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, material-date-fns-adapter
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-next.9
@angular-devkit/build-angular   17.0.0-next.9
@angular-devkit/core            17.0.0-next.9
@angular-devkit/schematics      17.0.0-next.9
@angular/cli                    17.0.0-next.9
@angular/fire                   7.5.0
@angular/ssr                    17.0.0-next.1
@schematics/angular             17.0.0-next.9
rxjs                            7.5.7
typescript                      5.2.2
zone.js                         0.14.0

Anything else?

Angular.json:


{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "cli": {
        "packageManager": "npm",
        "analytics": "ac59db6d-a680-408f-af50-2623fb62aeae"
    },
    "newProjectRoot": "projects",
    "projects": {
        "totti": {
            "projectType": "application",
            "schematics": {
                "@schematics/angular:component": {
                    "style": "scss",
                    "skipTests": true,
                    "standalone": true,
                    "changeDetection": "OnPush"
                },
                "@schematics/angular:class": {
                    "skipTests": true
                },
                "@schematics/angular:directive": {
                    "skipTests": true,
                    "standalone": true
                },
                "@schematics/angular:guard": {
                    "skipTests": true
                },
                "@schematics/angular:interceptor": {
                    "skipTests": true
                },
                "@schematics/angular:pipe": {
                    "skipTests": true,
                    "standalone": true
                },
                "@schematics/angular:resolver": {
                    "skipTests": true
                },
                "@schematics/angular:service": {
                    "skipTests": true
                }
            },
            "root": "",
            "sourceRoot": "src",
            "prefix": "app",
            "i18n": {
                "sourceLocale": "en-US",
                "locales": {
                    "da": {
                        "translation": "src/locale/messages.da.json"
                    },
                    "en": {
                        "translation": "src/locale/messages.en.json"
                    }
                }
            },
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "allowedCommonJsDependencies": [],
                        "outputPath": "dist/totti/",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": ["zone.js"],
                        "tsConfig": "tsconfig.app.json",
                        "inlineStyleLanguage": "scss",
                        "styles": ["src/styles/index.scss"],
                        "assets": ["src/assets", "src/robots.txt", "src/manifest.json"],
                        "scripts": [],
                        "serviceWorker": true,
                        "ngswConfigPath": "ngsw-config.json",
                        "localize": true,
                        "i18nDuplicateTranslation": "ignore"
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                },
                                {
                                    "replace": "src/app/shared/store/build-specifics/index.ts",
                                    "with": "src/app/shared/store/build-specifics/index.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "serviceWorker": true,
                            "namedChunks": false
                        },
                        "localprod": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.localprod.ts"
                                }
                            ],
                            "outputHashing": "all"
                        },
                        "test": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.test.ts"
                                },
                                {
                                    "replace": "src/app/shared/store/build-specifics/index.ts",
                                    "with": "src/app/shared/store/build-specifics/index.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "serviceWorker": true,
                            "namedChunks": false
                        },
                        "localtest": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.test.ts"
                                }
                            ],
                            "outputHashing": "all"
                        },
                        "development": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.dev.ts"
                                },
                                {
                                    "replace": "src/app/shared/store/build-specifics/index.ts",
                                    "with": "src/app/shared/store/build-specifics/index.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "sourceMap": true,
                            "vendorChunk": false,
                            "buildOptimizer": false,
                            "serviceWorker": true,
                            "namedChunks": false
                        },
                        "local": {
                            "buildOptimizer": false,
                            "optimization": false,
                            "sourceMap": true
                        },
                        "da": {
                            "localize": ["da"]
                        },
                        "en": {
                            "localize": ["en"]
                        }
                    },
                    "defaultConfiguration": "production"
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "configurations": {
                        "production": {
                        },
                        "localprod": {
                        },
                        "localtest": {
                        },
                        "test": {
                        },
                        "development": {
                        },
                        "local": {
                        },

                        "da": {
                        },
                        "en": {
                        }
                    },
                    "defaultConfiguration": "local"
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                    }
                },
                "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", "src/manifest.json"],
                        "styles": ["src/styles/index.scss"],
                        "scripts": []
                    }
                },
                "deploy": {
                    "builder": "@angular/fire:deploy",
                    "options": {
                        "prerender": false,
                        "ssr": false,
                        "browserTarget": "totti:build:production",
                        "firebaseProject": "fastorder-dev",
                        "firebaseHostingSite": "fresto-totti-dev"
                    }
                }
            }
        }
    }
}

@spock123
Copy link
Author

spock123 commented Oct 19, 2023

Angular.json before installing RC0 (I was using 17-next8)


{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "cli": {
        "packageManager": "npm",
        "analytics": "ac59db6d-a680-408f-af50-2623fb62aeae"
    },
    "newProjectRoot": "projects",
    "projects": {
        "totti": {
            "projectType": "application",
            "schematics": {
                "@schematics/angular:component": {
                    "style": "scss",
                    "skipTests": true,
                    "standalone": true,
                    "changeDetection": "OnPush"
                },
                "@schematics/angular:class": {
                    "skipTests": true
                },
                "@schematics/angular:directive": {
                    "skipTests": true,
                    "standalone": true
                },
                "@schematics/angular:guard": {
                    "skipTests": true
                },
                "@schematics/angular:interceptor": {
                    "skipTests": true
                },
                "@schematics/angular:pipe": {
                    "skipTests": true,
                    "standalone": true
                },
                "@schematics/angular:resolver": {
                    "skipTests": true
                },
                "@schematics/angular:service": {
                    "skipTests": true
                }
            },
            "root": "",
            "sourceRoot": "src",
            "prefix": "app",
            "i18n": {
                "sourceLocale": "en-US",
                "locales": {
                    "da": {
                        "translation": "src/locale/messages.da.json"
                    },
                    "en": {
                        "translation": "src/locale/messages.en.json"
                    }
                }
            },
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "allowedCommonJsDependencies": [],
                        "outputPath": "dist/totti/",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": ["zone.js"],
                        "tsConfig": "tsconfig.app.json",
                        "inlineStyleLanguage": "scss",
                        "styles": ["src/styles/index.scss"],
                        "assets": ["src/assets", "src/robots.txt", "src/manifest.json"],
                        "scripts": [],
                        "serviceWorker": true,
                        "ngswConfigPath": "ngsw-config.json",
                        "localize": true,
                        "i18nDuplicateTranslation": "ignore"
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                },
                                {
                                    "replace": "src/app/shared/store/build-specifics/index.ts",
                                    "with": "src/app/shared/store/build-specifics/index.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "serviceWorker": true,
                            "namedChunks": false
                        },
                        "localprod": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.localprod.ts"
                                }
                            ],
                            "outputHashing": "all"
                        },
                        "test": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.test.ts"
                                },
                                {
                                    "replace": "src/app/shared/store/build-specifics/index.ts",
                                    "with": "src/app/shared/store/build-specifics/index.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "serviceWorker": true,
                            "namedChunks": false
                        },
                        "localtest": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.test.ts"
                                }
                            ],
                            "outputHashing": "all"
                        },
                        "development": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.dev.ts"
                                },
                                {
                                    "replace": "src/app/shared/store/build-specifics/index.ts",
                                    "with": "src/app/shared/store/build-specifics/index.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "sourceMap": true,
                            "vendorChunk": false,
                            "buildOptimizer": false,
                            "serviceWorker": true,
                            "namedChunks": false
                        },
                        "local": {
                            "buildOptimizer": false,
                            "optimization": false,
                            "sourceMap": true
                        },
                        "da": {
                            "localize": ["da"]
                        },
                        "en": {
                            "localize": ["en"]
                        }
                    },
                    "defaultConfiguration": "production"
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "configurations": {
                        "production": {
                            "buildTarget": "totti:build:production"
                        },
                        "localprod": {
                            "buildTarget": "totti:build:localprod"
                        },
                        "localtest": {
                            "buildTarget": "totti:build:localtest"
                        },
                        "test": {
                            "buildTarget": "totti:build:test"
                        },
                        "development": {
                            "buildTarget": "totti:build:development"
                        },
                        "local": {
                            "buildTarget": "totti:build:local,en"
                        },

                        "da": {
                            "buildTarget": "totti:build:local,da"
                        },
                        "en": {
                            "buildTarget": "totti:build:local,en"
                        }
                    },
                    "defaultConfiguration": "local"
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                        "buildTarget": "totti: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", "src/manifest.json"],
                        "styles": ["src/styles/index.scss"],
                        "scripts": []
                    }
                },
                "deploy": {
                    "builder": "@angular/fire:deploy",
                    "options": {
                        "prerender": false,
                        "ssr": false,
                        "browserTarget": "totti:build:production",
                        "firebaseProject": "fastorder-dev",
                        "firebaseHostingSite": "fresto-totti-dev"
                    }
                }
            }
        }
    }
}




@spock123 spock123 changed the title NG17-RC0: Error: Schema validation failed NG17-RC0: Next8->RC0 changed angular.json Oct 19, 2023
@JeanMeche JeanMeche transferred this issue from angular/angular Oct 19, 2023
@alan-agius4 alan-agius4 self-assigned this Oct 19, 2023
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Oct 19, 2023
…y executed

Prior to this change there was a missing check that causes the migration to remove valid config when it was executed multiple times or on configs that do not contain the deprecated option.

Closes angular#26063
@alan-agius4
Copy link
Collaborator

Thanks for reporting the issue. I have a opened a PR to address this.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Oct 19, 2023
…y executed

Prior to this change there was a missing check that causes the migration to remove valid config when it was executed multiple times or on configs that do not contain the deprecated option.

Closes angular#26063
alan-agius4 added a commit that referenced this issue Oct 19, 2023
…y executed

Prior to this change there was a missing check that causes the migration to remove valid config when it was executed multiple times or on configs that do not contain the deprecated option.

Closes #26063
alan-agius4 added a commit that referenced this issue Oct 19, 2023
…y executed

Prior to this change there was a missing check that causes the migration to remove valid config when it was executed multiple times or on configs that do not contain the deprecated option.

Closes #26063

(cherry picked from commit 53f93b9)
@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 Nov 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants