ng update @angular/cli fails
ng update @angular/cli
Updating karma configuration
Updating configuration
Removing old config file (.angular-cli.json)
Writing config file (angular.json)
Some configuration options have been changed, please make sure to update any npm scripts which you may have modified.
DELETE .angular-cli.json
CREATE angular.json (4068 bytes)
UPDATE karma.conf.js (1848 bytes)
UPDATE package.json (4947 bytes)
UPDATE tslint.json (2637 bytes)
error An unexpected error occurred: "/Users/et2448/projects/tac/jfr/tac-jfr-js-client/package.json: Unexpected string in JSON at position 4756".
Package install failed, see above.
Versions
ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.0
Node: 9.11.1
OS: darwin x64
Angular: 6.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@angular/flex-layout 6.0.0-beta.15
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
node --version
v9.11.1
Repro steps
- Step 1
- Step 2
- Step 3
Observed behavior
ng update @angular/cli
Updating karma configuration
Updating configuration
Removing old config file (.angular-cli.json)
Writing config file (angular.json)
Some configuration options have been changed, please make sure to update any npm scripts which you may have modified.
DELETE .angular-cli.json
CREATE angular.json (4068 bytes)
UPDATE karma.conf.js (1848 bytes)
UPDATE package.json (4947 bytes)
UPDATE tslint.json (2637 bytes)
error An unexpected error occurred: "/Users/et2448/projects/tac/jfr/tac-jfr-js-client/package.json: Unexpected string in JSON at position 4756".
Package install failed, see above.
Note that it generates wrong json syntax in the migration step:
git diff package.json
diff --git a/package.json b/package.json
index 4183866..f499466 100644
--- a/package.json
+++ b/package.json
@@ -96,8 +96,9 @@
"ts-node": "4.1.0",
"tslint": "^5.10.0",
"tslint-sonarts": "^1.6.0",
- "typescript": "~2.7.2"
- },
+ "typescript": "~2.7.2," <-- comma inside hyphen, not after
+ "@angular-devkit/build-angular": "~0.6.0"
+ },
"_doc": "need to force consistent version due to transitive dep from ngx-configure:",
"resolutions": {
"@angular/core": "6.0.0"
Desired behavior
ng update should proceed and update package.json and generate my angular.json file etc
Same issue here, also on OS X.
After ng update @angular/cli, package.json ends up like this:
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
- "typescript": "~2.5.3"
- }
+ "typescript": "~2.5.,3" <-- comma inserted two characters too soon
+ "@angular-devkit/build-angular": "~0.6.0"
+ }
}
I already noticed this two-character offset on angular 5.2 with ng commands like ng g.
Might be a schematics-related issue...?
I see this is fixed, how should I proceed? Trying cli 6.0.1 it still fails:
Davids-Work-MacBook-Pro:tac-jfr-js-client et2448$ ng update @angular/cli --migrate-only --from=1.7.4
Updating karma configuration
Updating configuration
Removing old config file (.angular-cli.json)
Writing config file (angular.json)
Some configuration options have been changed, please make sure to update any npm scripts which you may have modified.
DELETE .angular-cli.json
CREATE angular.json (4068 bytes)
UPDATE karma.conf.js (1848 bytes)
UPDATE package.json (4943 bytes)
UPDATE tslint.json (2637 bytes)
error An unexpected error occurred: "/Users/et2448/projects/tac/jfr/tac-jfr-js-client/package.json: Unexpected string in JSON at position 4752".
Package install failed, see above.
ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.1
Node: 9.11.1
OS: darwin x64
Angular: 6.0.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.1
@angular-devkit/build-angular 0.6.1
@angular-devkit/build-optimizer 0.6.1
@angular-devkit/core 0.6.1
@angular-devkit/schematics 0.6.1
@angular/flex-layout 6.0.0-beta.15
@ngtools/webpack 6.0.1
@schematics/angular 0.6.1
@schematics/update 0.6.1
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
@hansl - see comment above. I don't have any files with BOM.
This issue still happening with @angular/cli 6.0.3
My tslint.json was empty, i added '{}' to have a valid json, ng update succeded after.
same issue when I run ng update @angular/cli Updating karma configuration Updating configuration Removing old config file (.angular-cli.json) Writing config file (angular.json) Invalid JSON character: "" at 0:0.
I am following the steps to update from 5.2 to 6 on update.angular.io and ran into a similar issue with ng update @angular/cli
...$ ng update @angular/cli Your global Angular CLI version (1.7.4) is greater than your local version (1.6.5). The local Angular CLI version is used.
To disable this warning use "ng set --global warnings.versionMismatch=false". The specified command update is invalid. For available options, see
ng help.
I wound up manually updating my package.json to cli version to my current version, saved it, ran npm install then ran ng update @angular/core (which is listed a few steps ahead of ng update @angular/cli on the website). During the the update core install I got this message...
The Angular CLI configuration format has been changed, and your existing configuration can be updated automatically by running the following command:
ng update @angular/cli
... so I re-ran ng update @angular/cli and so far so good.
Hope this helps!
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.