[Bug]: 错误:无法解析模块 storybook/internal/preview-api

atmip9wb  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(56)

描述bug

无法使用最新版本运行react-native

error Unable to resolve module storybook/internal/preview-api from /Users/alain/myproject/node_modules/@storybook/addon-actions/dist/preview.js: storybook/internal/preview-api could not be found within the project or in these directories:
  node_modules
  2 |
  3 | var uuid = require('uuid');
> 4 | var previewApi = require('storybook/internal/preview-api');
    |                           ^
  5 | var global = require('@storybook/global');
  6 | var previewErrors = require('storybook/internal/preview-errors');
  7 |.

使用的版本

"react-native": "0.74.3",
"@storybook/addon-actions": "^8.2.9",
"@storybook/addon-ondevice-actions": "^7.6.20",
"@storybook/addon-ondevice-controls": "^7.6.20",
"@storybook/addon-themes": "^8.2.9",
"@storybook/preview-api": "^8.2.9",
"@storybook/react": "^8.2.9",
"@storybook/react-native": "^7.6.20",
"@storybook/react-native-theming": "^7.6.20",

项目之前一直使用以下版本,但自从几个月前更新了react-native本身后,storybook停止工作。它大部分时间都卡在splascreen上。

"@storybook/addon-actions": "^7.6.17",
  "@storybook/addon-ondevice-actions": "^7.6.15",
  "@storybook/addon-ondevice-controls": "^7.6.15",
  "@storybook/addon-themes": "^7.6.17",
  "@storybook/react": "^7.6.17",
  "@storybook/react-native": "^7.6.15",
  "@storybook/react-native-theming": "^7.6.15",

复现链接

nolink.com

复现步骤

尝试运行项目

系统信息

System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M2 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.6.0 - /opt/homebrew/bin/node
    Yarn: 4.2.1 - /usr/local/bin/yarn <----- active
    npm: 10.8.2 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 127.0.6533.120
    Safari: 17.6
  npmPackages:
    @storybook/addon-actions: ^8.2.9 => 8.2.9
    @storybook/addon-ondevice-actions: ^7.6.20 => 7.6.20
    @storybook/addon-ondevice-controls: ^7.6.20 => 7.6.20
    @storybook/addon-themes: ^8.2.9 => 8.2.9
    @storybook/preview-api: ^8.2.9 => 8.2.9
    @storybook/react: ^8.2.9 => 8.2.9
    @storybook/react-native: ^7.6.20 => 7.6.20
    @storybook/react-native-theming: ^7.6.20 => 7.6.20

其他上下文

  • 无响应*
qhhrdooz

qhhrdooz1#

对我来说也是一样,升级到RN0.74后

相关问题