'React Storybook throws error when using npx sb init

I am trying to install Storybook on my project. All I do is initialize the create-react-app and then cd to the current directory. When I enter 'npx sb init' I am getting the following errors:

 • Detecting project type. ✓
 • Adding Storybook support to your "Create React App" based project
     Unable to find versions of @storybook/react using npm

     Unable to find versions of @storybook/addon-links using npm

     Unable to find versions of @storybook/addon-essentials using npm

     Unable to find versions of @storybook/addon-actions using npm

     Unable to find versions of @storybook/node-logger using npm

     Unable to find versions of @storybook/preset-create-react-app using npm

System Node: v16.13.0 NPM: 8.1.4 Ubuntu 21.10

Notes I was able to find a relatable problem here, but unfortunately it doesn't seem logical to init the project on a VM and then copy it locally..



Solution 1:[1]

I'm using Ubuntu 20.04. I had the same issue. The problem was that I had installed node through snap. https://github.com/nodesource/distributions/blob/master/README.md - here is the example how to install on Debian / Ubuntu without using snap.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1