1
votes

I'm trying to add a storybook to my project but I get this error

Adding Storybook support to your "Angular" app SyntaxError: Unexpected token ] in JSON at position 550 at JSON.parse () at readFileAsJson (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\helpers.js:60:15) at getAngularAppTsConfigJson (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\generators\ANGULAR\angular-helpers.js:47:38) at editAngularAppTsConfig (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\generators\ANGULAR\index.js:23:70) at generator (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\generators\ANGULAR\index.js:52:3) at runGenerator (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\initiate.js:162:37) at installStorybook (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\initiate.js:206:10) at _default (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\initiate.js:277:10) at Command. (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\dist\generate.js:34:566) at Command.listener [as _actionHandler] (C:\Users\Marouen\AppData\Roaming\npm-cache_npx\17500\node_modules@storybook\cli\node_modules\commander\index.js:413:31)

When I try to start

npx -p @storybook/cli sb init

I checked the Angular.json with a JSON linter and the file is validated! Does anyone know how to solve this??

1
Maybe your JSON is invalid?Justinas
@Justinas I copy pasted in jsonlint.com and it validated the fileMarouen Abdi

1 Answers

1
votes

I had a similar issue due to trailing comma in angular.json Please check again or share your solution.