4

我正在按照此处的教程设置故事书

它告诉我运行以下命令:

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

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

但是,在第三个命令之后它给了我

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

这看起来像是某种缓存问题,所以我尝试清除缓存并重新安装节点。但它仍然不起作用。

4

2 回答 2

2

你没有运行 npm init ...... 需要 package.json 文件

于 2019-11-04T14:39:55.407 回答
-1

我遇到了同样的问题,正如你提到的,它与缓存有关,我执行了下面的命令,它工作正常

yarn cache clean --force
npx -p @storybook/cli sb init -f
于 2020-06-23T17:52:42.287 回答