Skip to content

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

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

Closed
bhaidar opened this issue Aug 9, 2018 · 9 comments
Closed

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

bhaidar opened this issue Aug 9, 2018 · 9 comments
Labels
area: docs Related to the documentation freq1: low Only reported by a handful of users who observe it rarely needs: more info Reporter must clarify the issue severity1: confusing
Milestone

Comments

@bhaidar
Copy link

bhaidar commented Aug 9, 2018

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.

@bhaidar
Copy link
Author

bhaidar commented Aug 10, 2018

Anyone please?

@alexeagle
Copy link
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.

@ngbot ngbot bot added this to the needsTriage milestone Aug 10, 2018
@alexeagle alexeagle added the needs: more info Reporter must clarify the issue label Aug 10, 2018
@bhaidar
Copy link
Author

bhaidar commented Aug 10, 2018

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.

@cado1982
Copy link

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.

@bhaidar
Copy link
Author

bhaidar commented Aug 11, 2018

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": {}
  }
}

@hansl
Copy link
Contributor

hansl commented Aug 15, 2018

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.

@hansl hansl added freq1: low Only reported by a handful of users who observe it rarely severity1: confusing labels Aug 15, 2018
@bhaidar
Copy link
Author

bhaidar commented Aug 16, 2018

@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!

@hansl hansl added the area: docs Related to the documentation label Aug 16, 2018
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Aug 16, 2018
@mgechev
Copy link
Member

mgechev commented Aug 19, 2019

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.

@mgechev mgechev closed this as completed Aug 19, 2019
@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 Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: docs Related to the documentation freq1: low Only reported by a handful of users who observe it rarely needs: more info Reporter must clarify the issue severity1: confusing
Projects
None yet
Development

No branches or pull requests

5 participants