简体   繁体   English

如何启动 Storybook?

[英]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.但它仍然不起作用。

you didn't run npm init...... package.json file is needed你没有运行 npm init...... 需要 package.json 文件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM