我正在尝试为 Angular 8 设置 Storybook,但是在运行npm run storybook
时出现以下错误:
ERROR in /home/user/dev/storybook/src/stories/Button.stories.ts
ERROR in /home/user/dev/storybook/src/stories/Button.stories.ts(2,29):
TS2307: Cannot find module '@storybook/angular/types-6-0'.
ERROR in /home/user/dev/storybook/src/stories/Header.stories.ts
ERROR in /home/user/dev/storybook/src/stories/Header.stories.ts(1,32):
TS2307: Cannot find module '@storybook/angular'.
ERROR in /home/user/dev/storybook/src/stories/Header.stories.ts
ERROR in /home/user/dev/storybook/src/stories/Header.stories.ts(4,29):
TS2307: Cannot find module '@storybook/angular/types-6-0'.
ERROR in /home/user/dev/storybook/src/stories/Page.stories.ts
ERROR in /home/user/dev/storybook/src/stories/Page.stories.ts(1,45):
TS2307: Cannot find module '@storybook/angular'.
但是,@storybook/angular
是打开package.json
并安装,以及文件本身在使用 vscode 可视化时不会提示任何错误。我尝试使用谷歌的所有解决方案,例如:
- 导入所有内容
@storybook/angular
而不使用@storybook/angular/types-6-0
- 添加
@storybook/angular/types-6-0
到.storybook/typings.d.ts
- 添加
../src/setupJest.ts
到排除数组中.storybook/tsconfig.json
- 添加
"enableIvy": false
到tsconfig.json
下angularCompilerOptions
我究竟做错了什么?