You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error showed up while run the command ng generate module about #10880
Perhaps an issue with the encoding of angular.json, it's just a guess based on other related issues.
Try converting your angular.json file to utf-8 without BOM and see if that helps.
And of course verify that angular.json contains only valid json :-)
Thanks for the reply! The encoding of angular.json is the utf-8 without BOM. And It is a valid json file. Actually I haven't done anything with the angular.json. It is just a new project generated using angular-cli.
Same thing here. I'd be able to fix it myself if it at least said what file the error was found in.. I've checked every JSON file I can find (including angular.json), and all of them are valid.
Calling:ng g c components/index Error:Unexpected token } in JSON at position 1333
Alright, my issue's fixed. It appears the error's caused by something being wrong in angular.json - I must've missed it when manually looking through my files. I threw it in JSONLint and it immediately threw an error. You can obviously do this for other files, but I'm going to assume this error is mainly caused by angular.json.
@leoliuasia thank you! I had the same error and running my angular.json through json found the issue. There was a comment in the file that I had to remove. ng generate component works now.
Activity
phl3x0r commentedon May 16, 2018
Perhaps an issue with the encoding of angular.json, it's just a guess based on other related issues.
Try converting your angular.json file to utf-8 without BOM and see if that helps.
And of course verify that angular.json contains only valid json :-)
leoliuasia commentedon May 17, 2018
Thanks for the reply! The encoding of angular.json is the utf-8 without BOM. And It is a valid json file. Actually I haven't done anything with the angular.json. It is just a new project generated using angular-cli.
hitokiri commentedon May 20, 2018
I same problem
display error
Unexpected token ] in JSON at position 1337xlxAciDxlx commentedon May 20, 2018
Same thing here. I'd be able to fix it myself if it at least said what file the error was found in.. I've checked every JSON file I can find (including
angular.json), and all of them are valid.Calling:
ng g c components/indexError:
Unexpected token } in JSON at position 1333leoliuasia commentedon May 21, 2018
It looks like not just me had the problem, I think it may be an encoding problem, but not sure where it is.
xlxAciDxlx commentedon May 21, 2018
When I searched for the issue (to see if it already existed), yours was the first of many that had come up.
Yeah, same issue here. Running a linter and
tscall work fine, it just seems to be generating things that's broken for me.xlxAciDxlx commentedon May 21, 2018
Alright, my issue's fixed. It appears the error's caused by something being wrong in
angular.json- I must've missed it when manually looking through my files. I threw it in JSONLint and it immediately threw an error. You can obviously do this for other files, but I'm going to assume this error is mainly caused byangular.json.leoliuasia commentedon May 22, 2018
I’ll try it to see if it works for me.
leoliuasia commentedon May 22, 2018
I have found the problem. check the angular.json file.
just remove the comma after "src/assets" and "...default.css"
like below:
then will fix the problem.
Somehow if the comma is in js code it will work. But not here.
Thanks to @xlxAciDxlx !
hitokiri commentedon May 22, 2018
I do not have the commas, which you mention and I keep giving the error.
xlxAciDxlx commentedon May 22, 2018
@leoliuasia Glad you were able to get it fixed :D
@hitokiri Did you try running your
angular.jsonthrough JSONLint? Even if you don't have the commas, could be some other minor error messing it up.leoliuasia commentedon May 23, 2018
@hitokiri May be you need to check the other positons that not same as my. Or just use the JSONLint tool mentioned by @xlxAciDxlx
fix(@schematics/angular): Fix JSON parsing
fix(@schematics/angular): Fix JSON parsing
fix(@schematics/angular): Fix JSON parsing
fix(@schematics/angular): Fix JSON parsing
fix(@schematics/angular): Fix JSON parsing
fix(@schematics/angular): Fix JSON parsing
fix(@schematics/angular): Fix JSON parsing
shinks21 commentedon Jun 16, 2018
@leoliuasia thank you! I had the same error and running my angular.json through json found the issue. There was a comment in the file that I had to remove. ng generate component works now.
kaziupir commentedon Nov 11, 2018
I had comma in tsconfig.json, so try to check all json files in json lint.
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.
fix(@schematics/angular): Fix JSON parsing