Skip to content

ng update @angular/cli - Expected end of file #11825

Closed

Description

@bhaidar

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Node: v8.11.1
Npm: 5.6.0
NG: 6.1.2

Repro steps

npm install -g @angular/cli
npm install --save-dev @angular/cli@latest
ng update @angular/cli

The log given by the failure

   Updating karma configuration
   Updating configuration
   Removing old config file (.angular-cli.json)
   Writing config file (angular.json)
Expected end of file, got "w" at 140:0.

Mention any other details that might be useful

I have my application configured with Angular 5.2.0. also, the Angular CLI used to be 1.7.2.

Activity

  1. bhaidar commented on Aug 10, 2018

    @bhaidar
    Author

    Anyone please?

  2. alexeagle commented on Aug 10, 2018

    @alexeagle
    Contributor

    Did you look into the angular.json file? It's probably corrupted, is it easy to repair by hand?

    The repro steps are not sufficient since you need to have some older application state to trigger the error.

  3. added this to the needsTriage milestone on Aug 10, 2018
  4. bhaidar commented on Aug 10, 2018

    @bhaidar
    Author

    Hello @alexeagle
    I don't have yet the angular.json file. I am upgrading from angular 5 with .angular-cli.json file.

    I did all the upgrade and ran ng update and I get that nothing needs to be updated anymore, all is good.

    However, angular.json file is not being created!

    I am even trying to run ng update @angular/cli --migrate-only, it runs without any errors, but angular.json file is not being created.

    Also, when I run ng server I get this error:
    Local workspace file ('angular.json') could not be found.

  5. cado1982 commented on Aug 10, 2018

    @cado1982

    Please post your .angular-cli.json file. I guess it’s possible that if this file is corrupt or in a state that the updater doesn’t recognize that it could throw this error.

  6. bhaidar commented on Aug 11, 2018

    @bhaidar
    Author

    Hi @cado1982
    Here's a copy of my .angular-cli.json file. I just removed the scripts and styles not to paste a long content here.

    {
      "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
      "project": {
        "name": "client-app"
      },
      "apps": [
        {
          "root": "src",
          "outDir": "dist",
          "assets": [
            "assets",
            "favicon.ico",
            "web.config"
          ],
          "index": "index.html",
          "main": "main.ts",
          "polyfills": "polyfills.ts",
          "test": "test.ts",
          "tsconfig": "tsconfig.app.json",
          "testTsconfig": "tsconfig.spec.json",
          "prefix": "app",
          "styles": [],
          "scripts": [],
          "environmentSource": "environments/environment.ts",
          "environments": {
            "dev": "environments/environment.ts",
            "hmr": "environments/environment.hmr.ts",
            "prod": "environments/environment.prod.ts"
          }
        }
      ],
      "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": {}
      }
    }
  7. hansl commented on Aug 15, 2018

    @hansl
    Contributor

    I am even trying to run ng update @angular/cli --migrate-only, it runs without any errors, but angular.json file is not being created.

    You need to run ng update @angular/cli --migrate-only --from=5.0.0 (or from the current version). If you don't mention the from argument, it might think that everything is up to date already.

  8. bhaidar commented on Aug 16, 2018

    @bhaidar
    Author

    @hansl
    I did mention that and still, it won't work!
    What I did for now, is generate a new app with the latest angular-cli, copy the angular.json file and brought in all the contents of the old .angular-cli.json file and it seems to work for now!

  9. modified the milestones: needsTriage, Backlog on Aug 16, 2018
  10. mgechev commented on Aug 19, 2019

    @mgechev
    Member

    Hey @bhaidar, thanks for sharing the workaround. This seems like a problem with legacy configuration. Let's close the issue for now and revisit if it happens again. Please open a new ticket if this is still relevant.

  11. angular-automatic-lock-bot commented on Sep 19, 2019

    @angular-automatic-lock-bot

    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.

  12. locked and limited conversation to collaborators on Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsRelated to the documentationfreq1: lowOnly reported by a handful of users who observe it rarelyneeds: more infoReporter must clarify the issueseverity1: confusing

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions