故事书找不到模块“@storybook/angular”
Storybook Cannot find module '@storybook/angular'
我正在尝试为 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可视化时不会提示任何错误。我尝试使用 google 中的所有解决方案,例如:
- 从
@storybook/angular
导入所有内容而不使用 @storybook/angular/types-6-0
- 将
@storybook/angular/types-6-0
添加到 .storybook/typings.d.ts
- 将
../src/setupJest.ts
添加到 .storybook/tsconfig.json
中的排除数组
- 在
angularCompilerOptions
下将 "enableIvy": false
添加到 tsconfig.json
我做错了什么?
只需在 .storybook 目录中的“typings.d.ts”中添加以下行
declare module '@storybook/angular/demo'
我正在尝试为 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可视化时不会提示任何错误。我尝试使用 google 中的所有解决方案,例如:
- 从
@storybook/angular
导入所有内容而不使用@storybook/angular/types-6-0
- 将
@storybook/angular/types-6-0
添加到.storybook/typings.d.ts
- 将
../src/setupJest.ts
添加到.storybook/tsconfig.json
中的排除数组
- 在
angularCompilerOptions
下将
"enableIvy": false
添加到 tsconfig.json
我做错了什么?
只需在 .storybook 目录中的“typings.d.ts”中添加以下行
declare module '@storybook/angular/demo'