storybook: npx sb init error: Unable to find versions of @storybook/react using yarn
What’s the problem?
Whenever I try to run npx sb init in a project it fails with Unable to find versions of <dependency> using yarn error message.
Is there documentation on this? No
Additional context Kubuntu 20.04 Node v14.16.1 Yarn 1.22.10 npm 7.10.0
Examples:
$ npx sb init
sb init - the simplest way to add a Storybook to your project.
• Detecting project type. ✓
• Adding Storybook support to your "Create React App" based project
Unable to find versions of @storybook/react using yarn
Unable to find versions of @storybook/addon-links using yarn
Unable to find versions of @storybook/addon-essentials using yarn
Unable to find versions of @storybook/addon-actions using yarn
Unable to find versions of @storybook/node-logger using yarn
Unable to find versions of @storybook/preset-create-react-app using yarn
Does anybody knows what can I do?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 24 (1 by maintainers)
I managed to solve the problem following the following steps:
Step 1: Check npm and Node.js
Make sure you have Node.js and npm installed correctly. You can check the installed versions with the following commands:
node -vStep 2: Clear npm cache
Sometimes cache issues can cause these types of errors. Clear the npm cache with the following command:
npm cache clean --forceStep 3: Update npm
Make sure you are using the latest version of npm:
npm install -g npm@latestStep 4: Try installing the package again
After clearing the cache and updating npm, try installing the package that was having the problem again, in my case it was Storybook:
npx sb initAnd done!
If anyone encounters this issue in the future, just use the
npx sb initin another machine, either physical or virtual, to install storybook. Then, upload your project withoutnode_modulesto any git repo, and in your “faulty” machine just clone the project and runyarn install.This seems like a bug, but unfortunately I don’t have enough time to fix it and I just used this workaround.
Hello @danpaldev I solved this using the following command.
npm uninstall -g create-react-appthen
npm install -g create-react-appUpdate npm worked for me
I am getting this same error
(node:6875) [DEP0040] DeprecationWarning: Thepunycodemodule is deprecated. Please use a userland alternative instead. (Usenode --trace-deprecation …to show where the warning was created) Error: Unable to find versions of @storybook/cli using npmand I am not using CRA I am using Vite and React typescript
Hey @danpaldev Can you try this ?
Uninstalling Command:
npm uninstall -g create-react-appinstalling Command:
npx create-react-app my-appI am using Ubuntu 22.10. I had the same issue. The problem was that I had installed
NodeusingSnap.I solved the problem by installingNodeusingNVM.I have the same error when run npx storybook init
or this go through it
The command is as below:
npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-appThis is taken from one of the Stack Overflow posts.
https://stackoverflow.com/questions/64963796/create-react-app-is-not-working-since-version-4-0-1/65043610
Getting same error here with react + webpack + ts on a Mac.
Try cleaning up npx and npm caches. Then re-run again. It worked for me.
@Ayushsunny Thanks for your rapid response. It seems that you are suggesting that the issue is related to create-react-app? I don’t have any problems creating CRA apps using npx, but I just tried it anyways as I don’t know why this issue is happening.
The only issue that I have is that
npx sb initalways throws those yarn errors on every react project. Maybe is just an issue related to storybook?