Skip to content

update: Data path ".scripts[0]" should be object. #10314

@Splaktar

Description

@Splaktar

Versions

Angular CLI: 6.0.0-rc.4
Node: 8.10.0
OS: darwin x64
Angular: 6.0.0-rc.4
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.5.5
@angular-devkit/build-angular     0.5.5
@angular-devkit/build-optimizer   0.5.5
@angular-devkit/core              0.5.5
@angular-devkit/schematics        0.5.6
@angular/cdk                      6.0.0-rc.2
@angular/flex-layout              5.0.0-beta.13
@angular/material                 6.0.0-rc.2
@ngtools/json-schema              1.1.0
@ngtools/webpack                  6.0.0-rc.3
@schematics/angular               0.5.6
@schematics/update                0.5.6
rxjs                              5.6.0-forward-compat.4
typescript                        2.7.2
webpack                           4.5.0

Repro steps

  • Step 1 - Run ng update @angular/cli --migrate-only --from=1.7.4
  • Step 2 - Run ng serve

Observed behavior

Schema validation failed with the following errors:
  Data path ".scripts[0]" should be object.

Desired behavior

ng serve should work after running the migration.

Mention any other details that might be useful (optional)

.angular-cli.json from my working install of CLI 6.0.0-beta.5

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "webapp"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "manifest.json",
        "icons",
        "robots.txt",
        "sitemap.xml"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.scss"
      ],
      "scripts": [
        "../node_modules/hammerjs/hammer.js",
        "../node_modules/firebase/firebase-app.js",
        "../node_modules/firebase/firebase-auth.js",
        "../node_modules/firebase/firebase-database.js"
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "staging": "environments/environment.staging.ts",
        "prod": "environments/environment.prod.ts"
      },
      "serviceWorker": true
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": ["**/node_modules/**"]
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": ["**/node_modules/**"]
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": ["**/node_modules/**"]
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {
      "spec": false,
      "inlineStyle": false,
      "inlineTemplate": false
    },
    "directive": {
      "spec": false
    },
    "class": {
      "spec": false
    },
    "guard": {
      "spec": false
    },
    "module": {
      "spec": false
    },
    "pipe": {
      "spec": false
    },
    "service": {
      "spec": false
    }
  }
}

Resulting angular.json after migration

{
  "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "webapp": {
      "root": "",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets"
              },
              {
                "glob": "manifest.json",
                "input": "src",
                "output": "/"
              },
              {
                "glob": "**/*",
                "input": "src/icons",
                "output": "/icons"
              },
              {
                "glob": "robots.txt",
                "input": "src",
                "output": "/"
              },
              {
                "glob": "sitemap.xml",
                "input": "src",
                "output": "/"
              }
            ],
            "styles": [
              "src/styles.scss"
            ],
            "scripts": [
              "node_modules/hammerjs/hammer.js",
              "node_modules/firebase/firebase-app.js",
              "node_modules/firebase/firebase-auth.js",
              "node_modules/firebase/firebase-database.js"
            ]
          },
          "configurations": {
            "staging": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "serviceWorker": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ]
            },
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "serviceWorker": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "webapp:build"
          },
          "configurations": {
            "staging": {
              "browserTarget": "webapp:build:staging"
            },
            "production": {
              "browserTarget": "webapp:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "webapp:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/hammerjs/hammer.js",
              "node_modules/firebase/firebase-app.js",
              "node_modules/firebase/firebase-auth.js",
              "node_modules/firebase/firebase-database.js"
            ],
            "styles": [
              "src/styles.scss"
            ],
            "assets": [
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets"
              },
              {
                "glob": "manifest.json",
                "input": "src",
                "output": "/"
              },
              {
                "glob": "**/*",
                "input": "src/icons",
                "output": "/icons"
              },
              {
                "glob": "robots.txt",
                "input": "src",
                "output": "/"
              },
              {
                "glob": "sitemap.xml",
                "input": "src",
                "output": "/"
              }
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "webapp-e2e": {
      "root": "",
      "projectType": "application",
      "cli": {},
      "schematics": {},
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "webapp:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "cli": {},
  "schematics": {
    "@schematics/angular:class": {
      "spec": false
    },
    "@schematics/angular:component": {
      "spec": false,
      "inlineStyle": false,
      "inlineTemplate": false,
      "prefix": "app",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "spec": false,
      "prefix": "app"
    },
    "@schematics/angular:guard": {
      "spec": false
    },
    "@schematics/angular:module": {
      "spec": false
    },
    "@schematics/angular:pipe": {
      "spec": false
    },
    "@schematics/angular:service": {
      "spec": false
    }
  }
}

If you see my output from rc.3 (found in #10311), you can see that it was migrating scripts to objects, but rc.4 is not.

I also tried ng update @angular/cli --migrate-only --from=6.0.0-beta.5 and ng update @angular/cli --migrate-only --from=1.7.3 but that had the same problem with scripts as strings.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentneeds: more infoReporter must clarify the issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions