'start-storybook' is not recognized as an internal or external command,
Asked Answered
J

4

9
PS C:..project\src\features> npm run storybook

> [email protected] storybook
> start-storybook -p 6006

'start-storybook' is not recognized as an internal or external command,
operable program or batch file.

Installed storybook but can't seem to make it run. I tried npm install, will not help.

npm: '8.1.0', node: '16.13.0' "react": "^17.0.1",

Jacobba answered 13/11, 2021 at 14:2 Comment(4)
why not npm run start-storybook? Regardless this is a $PATH issue. Using the full path to start-storybook is likely the easiest way to solve it.End
this is not the path i use, path is changed due anonimityJacobba
well sure, but the path you use isn't working: if you're calling my\path\start-storybook and it says 'not recognised as command` you're not pointing at the executableEnd
fixed it, node version had to be changed. not a path issueJacobba
J
5

Apparently the node version had to be downgraded to 14.15.0. After that I did rm -rf node_modules and then npm install. Since I am using Windows, before changing node version, I had to install NVM for Windows, then install the right node version and change it in CMD (have to run as Administrator).

Jacobba answered 13/11, 2021 at 16:19 Comment(1)
A major part of this fix is that the node_modules was reinstalled. A node downgrade may not be needed for most people, just clearing node_modules and reinstalling with the storybook packages.Incomprehensible
G
5

After running npx sb init

then run npx sb@next automigrate

Then lastly modify your scripts in package.json to:

"storybook": "sb dev",

"build-storybook": "sb build"

Guadalcanal answered 10/4, 2023 at 15:46 Comment(0)
B
3

I had the same problem, all you have to do is change the version of all the storybook packages in package.jscon to the same version (preferably to the lowest version that any package has, for example all packages have version 7.2.04 and one has 6.5.16 then you change it to 6.5.16) then you remove node_modules and package-lock.json and then npm or yarn and it should be fine

Bother answered 5/4, 2023 at 22:29 Comment(3)
Worked for me. "@storybook/addon-actions": "^6.5.16", "@storybook/addon-essentials": "^6.4.22", "@storybook/addon-interactions": "^6.5.16", "@storybook/addon-links": "^6.5.16", "@storybook/builder-webpack5": "^6.5.16", "@storybook/manager-webpack5": "^6.5.16", "@storybook/node-logger": "^6.5.16", "@storybook/preset-create-react-app": "^4.1.2", "@storybook/react": "^6.1.21", "@storybook/testing-library": "^0.0.13",Woll
This worked for me also as it installed a mix of v6 and v7 packages, so manually downgrading the v7 ones back to the same v6 version got everything working!Brunhild
In my case I have an Angular project, but once I downgraded all versions to 6.5.16 it gives me error with react saying that it's not installed. But after the install there is no changeTerrie
I
1

Storybook may not have actually been loaded into your node_modules folder.

After installing storybook using a utility like npx storybook@latest, you then must actually load the storybook code into your node_modules folder. Do this with npm i if using npm, or running yarn if using yarn.

Incomprehensible answered 21/6, 2023 at 18:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.