question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrading to angular 6 fails during angular-cli migration with unexpected token.

See original GitHub issue

Versions

6.0.0-rc.5

Repro steps

ng update @angular/cli --migrate-only --from=1

using the following .angular-cli.json file.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "ui-sdk"
  },
  "packageManager": "yarn",
  "apps": [
    {
      "name": "lib",
      "root": "src/lib",
      "outDir": "lib",
      "assets": [],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "sym",
      "styles": [],
      "scripts": [
        "../../node_modules/@webcomponents/custom-elements/custom-elements.min.js"
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    },
    {
      "name": "demo",
      "root": "src/demo",
      "outDir": "demo",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "polyfills": "polyfills.ts",
      "tsconfig": "tsconfig.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "sym",
      "styles": [
        "vendor.scss",
        "styles.scss"
      ],
      "scripts": [
        "../../node_modules/@webcomponents/custom-elements/custom-elements.min.js",
        "../../vendor/vts.js"
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts",
        "e2e": "environments/environment.e2e.ts",
        "upgrade": "environments/environment.upgrade.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/lib/tsconfig.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/lib/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/demo/tsconfig.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/demo/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/testing/tsconfig.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/cli/tsconfig.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css"
  }
}

Observed behavior

mkrotscheck-a02:sdk mkrotscheck$ ng update @angular/cli --migrate-only --from=1
            Updating karma configuration
            Updating configuration
            Removing old config file (.angular-cli.json)
            Writing config file (angular.json)
Unexpected token / in JSON at position 240

Desired behavior

Successful app migration, or helpful error 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:35 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
Rumsha001commented, May 15, 2018

Hey, After alot of research, I have come up with following solution and got success in updating my local project to Angular 6.0.1:

  1. npm install @angular/{animations,common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router}@‘6.0.1’
  2. ng update rxjs
  3. npm install rxjs@6 rxjs-compat@6 --save
  4. ng update @angular/core
  5. ng update @angular/material
  6. npm install typescript@‘>=2.7.0 <2.8.0’

Please respond and share! Thanks

6reactions
phl3x0rcommented, May 4, 2018

update: this is still an issue with 6.0 final

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng update: Unexpected token T in JSON at position 0: TF400813
The solution was to remove this dependence, run the ng update and then put again the dependecies on package.json and the update worked....
Read more >
Deprecated APIs and features - Angular
This guide contains a summary of all Angular APIs and features that are currently deprecated. Features and APIs that were deprecated in v6...
Read more >
angular/angular-cli - Gitter
Anyone that had a problem with node-gyp after migrating to webpack.8 ? ... /lib/node_modules/angular-cli/lib/bootstrap-local.js:30:14) Unexpected token .
Read more >
Angular Upgrade Cli Unexpected Token At Position 0 - ADocLib
Usually this error is caused when your server returns HTML which typically begins with DOCTYPE html or html instead of JSON.Valid JSON cannot ......
Read more >
nx jest unexpected token 'export' - You.com | The AI Search ...
This means, that a file is not transformed through TypeScript compiler, e.g. because it is a JS file with TS syntax, or it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found