Search code examples
javascriptreactjsstorybook

Storybook. Invalid version. Must be a string. Got type "object"


When I try to install storybook I get this. What's wrong?

npx storybook@latest init

 • Detecting project type. ✓
TypeError: Invalid version. Must be a string. Got type "object".

npm clean cache --force

Solution

  • I faced the very same issue, check out the stack trace, something along the line:

    .npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:12:6408
    

    It will help you to understand which dependency is a problem. In my case I had

    "typescript":"*"
    

    In my package.json configuration and that was a problem. Re-installed typescript:

    yarn add -D typescript@latest
    

    solved the problem