Repository navigation
Upgrading to angular 6 fails during angular-cli migration with unexpected token. #10396
Copy link
Copy link
Closed
Closed
Copy link
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone
Description
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 :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Activity
krotscheck commentedon Apr 19, 2018
@StephenFluin
krotscheck commentedon Apr 19, 2018
A bit of comment-out-line-by-line debugging: The issue appears to be the
"root": "path-with-directory/slash"if I remove the subdirectory, it works like a charm.
gnomeontherun commentedon Apr 25, 2018
I'm also having the same issue for Clarity, which you can find our project at https://github.com/vmware/clarity/tree/website/latest. The angular-cli.json file is at https://github.com/vmware/clarity/blob/website/latest/.angular-cli.json.
I haven't been able to migrate even with the suggestion by @krotscheck.
StephenFluin commentedon Apr 28, 2018
@hansl I think we already fixed this one, can you check?
filipesilva commentedon Apr 30, 2018
@krotscheck and @gnomeontherun can you try with
@angular/cli@6.0.0-rc.7? Using your.angular-cli.jsonfiles and runningng update @angular/cli, I did not see the errors.wopss commentedon Apr 30, 2018
@filipesilva I have the same problem with
@angular/cli@6.0.0-rc.7when upgrading from 1.7.4. My.angular-cli.jsonis{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { "name": "client" }, "packageManager": "yarn", "apps": [ { "root": "src/browser", "outDir": "../../Build/Client/ui", "assets": [], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "tsconfig": "tsconfig.app.json", "prefix": "app", "styles": [ "styles/app.scss" ], "scripts": [], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } } ], "lint": [ { "project": "src/browser/tsconfig.app.json", "exclude": "**/node_modules/**" } ], "defaults": { "styleExt": "scss", "class": { "spec": false }, "component": { "spec": false }, "directive": { "spec": false }, "guard": { "spec": false }, "module": { "spec": false }, "pipe": { "spec": false }, "service": { "spec": false } } }The output
Versions
fix(@schematics/angular): use the JSON AST for changing JSON files in…
krotscheck commentedon Apr 30, 2018
@filipesilva No luck from me, though likely for unrelated reasons. We just refactored into a
yarn workspacesbased monorepo, and attempting to migrate our project from within the child workspaces gave me this:I suspect that issue's reported elsewhere.
(Side note - yeah, I know
ngnow supports its own monorepo-style structure, and I'm trying to use it for a different project. In this one, unfortunately, we're shipping more-than-just angular packages, so I a more traditional monorepo is called for)fix(@schematics/angular): use the JSON AST for changing JSON files in…
fix(@schematics/angular): use the JSON AST for changing JSON files in…
17 remaining items
Ks89 commentedon May 15, 2018
I confirm the solution of @phl3x0r.
It's crazy, I know, but removing all lines in tsconfig files with test.ts and so on, I fixed this error.
PS: I'm using angular-cli 6.0.1
andynrkri commentedon May 16, 2018
In my case, I had commented a script array entry with
/*..*/inangular.json. Removing this resolved the error. I believe it happened because JSON doesn't support any comments as per specification.affilnost commentedon May 16, 2018
I had similar problem, updating Node from v6.10.2 to v10.1.0 did the trick.
bandersen22000 commentedon May 28, 2018
I fixed the issue by converting the following .json files (tsconfig, angular-cli.json, tslint) to UTF8, without BOM.
JigneshPatel04 commentedon May 29, 2018
I have followed https://update.angular.io/ and
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.
Anyone know?
Al-Sharif commentedon Jun 4, 2018
I was using visual studio code, i noticed the file encoding for
angular-cli.jsonandpackage.jsonis UTF-8 and BOM, press on the label in the bottom then save with encoding and choose UTF-8. That's worked for me.JigneshPatel04 commentedon Jun 4, 2018
My project tsconfig.json and tslint.json with UTF-8 and BOM so I choose UTF-8 and resolve it ago.
but thanks to reply .
fix(@schematics/angular): use the JSON AST for changing JSON files in…
dmsysop commentedon Jun 13, 2018
Guys, I was having the same problem and managed to fix just leaving the tslint.json file as it was by default.
To avoid tslint "errors" I had commented on some of the lines that he understands as error, but that are not ... (whitespace true - for example)
Just correcting this, he did the update normally!
Hope this helps someone else.
Good luck !!
neridonk commentedon Jun 21, 2018
You not only have to change tslint.json, you have to change also in folder "src" the tsconfigs , test.ts, . Any that is affected on this update
bhaidar commentedon Aug 10, 2018
I am also facing a similar issue. I've detailed it here, if someone can have a look please.
#11825
RicardoGomesRocha commentedon Sep 25, 2018
I my case I was getting the following error:
The solution in my case could be found on this stackoverflow post
xtrrdnryprgrmmr commentedon Oct 15, 2018
trying create a jhipster project with angular 6 .when i run "ng serve" command ,i took error in below.
please help me
Could not determine a single project for the 'serve' target.
Error: Could not determine a single project for the 'serve' target.
at ServeCommand.getProjectNamesByTarget (C:\Users\pc\complexdemo\node_modules@angular\cli\models\architect-command.js:184:19)
at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (C:\Users\pc\complexdemo\node_modules@angular\cli\models\architect-command.js:58:43)
at MergeMapSubscriber._tryNext (C:\Users\pc\complexdemo\node_modules\rxjs\internal\operators\mergeMap.js:122:27)
at MergeMapSubscriber._next (C:\Users\pc\complexdemo\node_modules\rxjs\internal\operators\mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (C:\Users\pc\complexdemo\node_modules\rxjs\internal\Subscriber.js:103:18)
at TapSubscriber._next (C:\Users\pc\complexdemo\node_modules\rxjs\internal\operators\tap.js:109:26)
at TapSubscriber.Subscriber.next (C:\Users\pc\complexdemo\node_modules\rxjs\internal\Subscriber.js:103:18)
at MergeMapSubscriber.notifyNext (C:\Users\pc\complexdemo\node_modules\rxjs\internal\operators\mergeMap.js:141:26)
at InnerSubscriber._next (C:\Users\pc\complexdemo\node_modules\rxjs\internal\InnerSubscriber.js:30:21)
at InnerSubscriber.Subscriber.next (C:\Users\pc\complexdemo\node_modules\rxjs\internal\Subscriber.js:103:18)
angular-automatic-lock-bot commentedon Sep 8, 2019
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.