Robert
Robert

Reputation: 103

How do I initiate Storybook?

I'm following the tutorial here to set up a Storybook

It tells me to run the following commands:

# Create our application:
npx create-react-app taskbox
cd taskbox

# Add Storybook:
npx -p @storybook/cli sb init

However, after the third command it gives me

npm ERR! code ENOLOCAL
npm ERR! Could not install from "<last-name>\AppData\Roaming\npm-cache\_npx\8504" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<name>\AppData\Roaming\npm- 
cache\_logs\2019-11-04T14_32_25_838Z-debug.log
Install for [ '@storybook/cli@latest' ] failed with code 1

This looks like some kind of cache issue, so I've tried clearing my cache and reinstalling node. But it still doesn't work.

Upvotes: 4

Views: 1210

Answers (2)

Ananth
Ananth

Reputation: 797

I faced the same issue and as you mentioned it was related to the cache and I executed below commands and it is working fine

yarn cache clean --force
npx -p @storybook/cli sb init -f

Upvotes: -1

Nahid Hasan
Nahid Hasan

Reputation: 707

you didn't run npm init ...... package.json file is needed

Upvotes: 2

Related Questions