4

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.

Robert
  • 93
  • 9

2 Answers2

2

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

Nahid Hasan
  • 687
  • 1
  • 10
  • 34
  • @mruanova that guide seems to work now. I also tried it earlier and it didn't work then, but that was before I reinstalled node – Robert Nov 04 '19 at 14:52
  • I added a comment before pointing out that this answer does not answer my question in any way. Someone has removed my comment, and left this answer. I find this quite irritating. Also they removed @mruanova's comment so my surviving comment no longer makes sense. – Robert Mar 09 '20 at 09:13
-1

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
Ananth
  • 787
  • 5
  • 18