【发布时间】:2022-07-30 10:47:38
【问题描述】:
我想在包含几个前端组件库实现的根目录中初始化 Storybook
project/
// Storybook should be initialized here...
vue-library/
twig-library/
svelte-library/
当我尝试在 project/ 目录中运行任何这些命令时,我会收到错误消息。
npm install @storybook/cli
npx storybook init
错误:
npm WARN
Could not resolve dependency:
peer react@"^18.2.0" from the root project
ERESOLVE overriding peer dependency
While resolving: react-dom@18.2.0
Found: peer react@"^18.2.0" from the root project.
我也尝试从 vue-library/ 文件夹中初始化故事书,但我收到了同样的错误。
我还尝试通过手动将对等依赖项添加到project/ 目录中的package.json 来自行安装react 作为对等依赖项:
{
"name": "********-********-*********",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "*********************************"
},
"dependencies": {
"@storybook/cli": "^6.5.9"
},
"peerDependencies": {
"react": "^18.2.0" <-------------- ADDED THIS
},
"author": "**** **",
"license": "ISC"
}
但这并没有解决问题。
有什么想法吗?
【问题讨论】: