NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.34k stars 4.77k forks source link

TypeError: Cannot read property 'Component' of undefined #16209

Open TuringZhu opened 1 month ago

TuringZhu commented 1 month ago

相关平台

微信小程序

复现仓库

https://gitlab.com/Turing7/mini_app_tmpl_taro_react.git 小程序基础库: 3.5.2 使用框架: React

复现步骤

在windows上执行 taro init PROJECT_NAME ,选择 react,npm,sass,github,taro-ui 参数. 然后编译并在微信开发者工具中预览

期望结果

出现Hello World等示例代码

实际结果

微信开发者工具中标题为首页,页面空白, 控制台报错

环境信息

PS D:\src\mini_app_taro_react> .\node_modules\.bin\taro.cmd info
👽 Taro v4.0.4

(node:28312) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

  Taro CLI 4.0.4 environment info:
    System:
      OS: Windows 11 10.0.22631
    Binaries:
      Node: 22.5.1 - D:\applications\node\node.EXE
      npm: 10.8.2 - D:\applications\node\npm.CMD
    npmPackages:
      @tarojs/cli: 4.0.4 => 4.0.4
      @tarojs/components: 4.0.4 => 4.0.4
      @tarojs/helper: 4.0.4 => 4.0.4
      @tarojs/plugin-framework-react: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-alipay: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-h5: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-jd: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-qq: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-swan: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-tt: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-weapp: 4.0.4 => 4.0.4
      @tarojs/react: 4.0.4 => 4.0.4
      @tarojs/runtime: 4.0.4 => 4.0.4
      @tarojs/shared: 4.0.4 => 4.0.4
      @tarojs/taro: 4.0.4 => 4.0.4
      @tarojs/vite-runner: 4.0.4 => 4.0.4
      babel-preset-taro: 4.0.4 => 4.0.4
      eslint-config-taro: 4.0.4 => 4.0.4
      react: ^18.0.0 => 18.3.1
      taro-ui: ^3.2.1 => 3.3.0

PS D:\src\mini_app_taro_react>

补充信息

"name": "taro-ui",
"typescript": true,
"css": "Sass",
"framework": "React"
narutohinata commented 1 month ago

我也遇到了

yetnelson commented 1 month ago

请问解决了吗?