Skip to content
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

Error when following the guide for setting up storybook with Angular #8475

Closed
beelio opened this issue Oct 18, 2019 · 5 comments
Closed

Error when following the guide for setting up storybook with Angular #8475

beelio opened this issue Oct 18, 2019 · 5 comments

Comments

@beelio
Copy link

beelio commented Oct 18, 2019

Getting error SyntaxError: Unexpected token ] in JSON at position 195 when running run storybook

Steps to reproduce

I tried to follow the steps described here: https://storybook.js.org/docs/guides/guide-angular/

When running run storybook I get SyntaxError: Unexpected token ] in JSON at position 195

Version of Storybook

"@storybook/addon-actions": "^5.2.4",
"@storybook/addon-links": "^5.2.4",
"@storybook/addon-notes": "^5.2.4",
"@storybook/addons": "^5.2.4",
"@storybook/angular": "^5.2.4",

Console error output

ERR! SyntaxError: Unexpected token ] in JSON at position 195
ERR!     at JSON.parse (<anonymous>)
ERR!     at getTsConfigOptions (/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/angular-cli_config.js:32:25)
ERR!     at Object.getAngularCliWebpackConfigOptions (/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/angular-cli_config.js:57:20)
ERR!     at Object.webpackFinal (/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/framework-preset-angular-cli.js:7:56)
ERR!     at /Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/core/dist/server/presets.js:82:72
ERR!     at processTicksAndRejections (internal/process/task_queues.js:89:5)
ERR!  SyntaxError: Unexpected token ] in JSON at position 195
ERR!     at JSON.parse (<anonymous>)
ERR!     at getTsConfigOptions (/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/angular-cli_config.js:32:25)
ERR!     at Object.getAngularCliWebpackConfigOptions (/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/angular-cli_config.js:57:20)
ERR!     at Object.webpackFinal (/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/framework-preset-angular-cli.js:7:56)
ERR!     at /Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/core/dist/server/presets.js:82:72
ERR!     at processTicksAndRejections (internal/process/task_queues.js:89:5) {
ERR!   stack: 'SyntaxError: Unexpected token ] in JSON at position 195\n    at ' +
ERR!     'JSON.parse (<anonymous>)\n    at getTsConfigOptions ' +
ERR!     '(/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/angular-cli_config.js:32:25)\n' +
ERR!     '    at Object.getAngularCliWebpackConfigOptions ' +
ERR!     '(/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/angular-cli_config.js:57:20)\n' +
ERR!     '    at Object.webpackFinal ' +
ERR!     '(/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/angular/dist/server/framework-preset-angular-cli.js:7:56)\n' +
ERR!     '    at ' +
ERR!     '/Users/joelsjostrom/sr/seating-project/seating-client/node_modules/@storybook/core/dist/server/presets.js:82:72\n' +
ERR!     '    at processTicksAndRejections (internal/process/task_queues.js:89:5)'
ERR! }
@NilsEngelbach
Copy link

@beelio I had a similar issue and was able to fix it by checking the angular.json file. It contained a wrong , (comma).

@stale
Copy link

stale bot commented Nov 27, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Nov 27, 2019
@stale
Copy link

stale bot commented Dec 27, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@sanjay51
Copy link

sanjay51 commented Aug 20, 2020

Found the culprit (note the extra comma before ] ) -
image

@IsaacSomething
Copy link

In my case the stories folder was in the src. Moving this out to the root of the project and updating the storybook/main.js to

module.exports = {
  stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
  addons: ['@storybook/addon-links', '@storybook/addon-essentials']
};

solved the issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants