NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.53k stars 758 forks source link

taro-rn使用taro-ui报错 #1768

Closed 2943102883 closed 3 months ago

2943102883 commented 6 months ago

问题描述

taro开发app使用了taro-ui。在运行的时候报错 image

有看到有支持rn的版本,扫码后报错 image

复现步骤

1、taro init test 2、cd test 3、yarn 4、yarn add taro-ui@3.7.0-beta.0 5、app.ts中添加import 'taro-ui/dist/style/index.scss' 6、在页面中使用Button

期望行为

看见一个button

报错信息

transform[stderr]:       dartException: [Circular *1],
transform[stderr]:       '$cachedTrace': _StackTrace {
transform[stderr]:         _exception: [Circular *2],
transform[stderr]:         _trace: "Error: Invalid argument(s): Uri e:%5CTaroFlexCode%5Cdemo_rn%5Cnode_modules%5Ctaro-ui%5Cdist%5Cstyle%5Cvariables%5Cdefault.rn.scss must have scheme 'file:'.\n" +
transform[stderr]:           '    at Object.wrapException (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:1240:17)\n' +
transform[stderr]:           '    at WindowsStyle.pathFromUri$1 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:33270:17)\n' +
transform[stderr]:           '    at StaticClosure.fromUri (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:16166:37)\n' +
transform[stderr]:           '    at Object.NullableExtension_andThen0 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:18492:40)\n' +
transform[stderr]:           '    at Object._wrapException (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:13049:14)\n' +
transform[stderr]:           '    at _render_closure1.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:82164:21)\n' +
transform[stderr]:           '    at _RootZone.runBinary$3$3 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:27587:18)\n' +
transform[stderr]:           '    at _FutureListener.handleError$1 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26136:19)\n' +
transform[stderr]:           '    at _Future__propagateToListeners_handleError.call$0 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26434:49)\n' +
transform[stderr]:           '    at Object._Future__propagateToListeners (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4550:77)\n' +
transform[stderr]:           '    at _Future._completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26266:9)\n' +
transform[stderr]:           '    at _AsyncAwaitCompleter.completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25920:12)\n' +
transform[stderr]:           '    at Object._asyncRethrow (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4349:17)\n' +
transform[stderr]:           '    at E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:12865:20\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.$protected (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4374:15)\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25941:12)\n' +
transform[stderr]:           '    at _awaitOnObject_closure0.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25933:25)\n' +
transform[stderr]:           '    at _RootZone.runBinary$3$3 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:27587:18)\n' +
transform[stderr]:           '    at _FutureListener.handleError$1 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26136:19)\n' +
transform[stderr]:           '    at _Future__propagateToListeners_handleError.call$0 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26434:49)\n' +
transform[stderr]:           '    at Object._Future__propagateToListeners (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4550:77)\n' +
transform[stderr]:           '    at _Future._completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26266:9)\n' +
transform[stderr]:           '    at _AsyncAwaitCompleter.completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25920:12)\n' +
transform[stderr]:           '    at Object._asyncRethrow (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4349:17)\n' +
transform[stderr]:           '    at E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:18176:20\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.$protected (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4374:15)\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25941:12)\n' +
transform[stderr]:           '    at _awaitOnObject_closure0.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25933:25)\n' +
transform[stderr]:           '    at _RootZone.runBinary$3$3 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:27587:18)\n' +
transform[stderr]:           '    at _FutureListener.handleError$1 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26136:19)\n' +
transform[stderr]:           '    at _Future__propagateToListeners_handleError.call$0 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26434:49)\n' +
transform[stderr]:           '    at Object._Future__propagateToListeners (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4550:77)\n' +
transform[stderr]:           '    at _Future._completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26266:9)\n' +
transform[stderr]:           '    at _AsyncAwaitCompleter.completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25920:12)\n' +
transform[stderr]:           '    at Object._asyncRethrow (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4349:17)\n' +
transform[stderr]:           '    at E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:18214:20\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.$protected (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4374:15)\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25941:12)\n' +
transform[stderr]:           '    at _awaitOnObject_closure0.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25933:25)\n' +
transform[stderr]:           '    at _RootZone.runBinary$3$3 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:27587:18)\n' +
transform[stderr]:           '    at _FutureListener.handleError$1 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26136:19)\n' +
transform[stderr]:           '    at _Future__propagateToListeners_handleError.call$0 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26434:49)\n' +
transform[stderr]:           '    at Object._Future__propagateToListeners (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4550:77)\n' +
transform[stderr]:           '    at _Future._completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:26266:9)\n' +
transform[stderr]:           '    at _AsyncAwaitCompleter.completeError$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25920:12)\n' +
transform[stderr]:           '    at Object._asyncRethrow (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4349:17)\n' +
transform[stderr]:           '    at E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:69083:20\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.$protected (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:4374:15)\n' +
transform[stderr]:           '    at _wrapJsFunctionForAsync_closure.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25941:12)\n' +
transform[stderr]:           '    at _awaitOnObject_closure0.call$2 (E:\\TaroFlexCode\\demo_rn\\node_modules\\@tarojs\\rn-style-transformer\\node_modules\\sass\\sass.dart.js:25933:25)'
transform[stderr]:       }
transform[stderr]:     }
transform[stderr]:   }
transform[stderr]: }
transform[stderr]:
transform[stderr]: Node.js v20.6.1

系统信息


  Taro CLI 3.6.24 environment info:
    System:
      OS: Windows 10 10.0.19042
    Binaries:
      Node: 20.6.1 - D:\Program Files\nvm\nodejs\node.EXE
      Yarn: 1.22.21 - D:\Program Files\nvm\nodejs\yarn.CMD
      npm: 9.8.1 - D:\Program Files\nvm\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.24 => 3.6.24
      @tarojs/components: 3.6.24 => 3.6.24
      @tarojs/components-rn: ^3.6.24 => 3.6.24
      @tarojs/helper: 3.6.24 => 3.6.24
      @tarojs/plugin-framework-react: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-alipay: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-h5: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-jd: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-qq: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-swan: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-tt: 3.6.24 => 3.6.24
      @tarojs/plugin-platform-weapp: 3.6.24 => 3.6.24
      @tarojs/react: 3.6.24 => 3.6.24
      @tarojs/rn-runner: ^3.6.24 => 3.6.24
      @tarojs/rn-supporter: ^3.6.24 => 3.6.24
      @tarojs/runtime: 3.6.24 => 3.6.24
      @tarojs/runtime-rn: ^3.6.24 => 3.6.24
      @tarojs/shared: 3.6.24 => 3.6.24
      @tarojs/taro: 3.6.24 => 3.6.24
      @tarojs/taro-loader: 3.6.24 => 3.6.24
      @tarojs/taro-rn: ^3.6.24 => 3.6.24
      @tarojs/webpack5-runner: 3.6.24 => 3.6.24
      babel-preset-taro: 3.6.24 => 3.6.24
      eslint-config-taro: 3.6.24 => 3.6.24
      expo: ~47.0.3 => 47.0.14
      react: ^18.1.0 => 18.2.0
      react-native: ^0.70.5 => 0.70.15
      taro-ui: ^3.7.0-beta.0 => 3.2.0-beta.0

补充信息

taro-ui-bot[bot] commented 6 months ago

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

robinv8 commented 4 months ago

目前最新版 taro-ui 版本是 3.3.0,先安装最新版试试,如果还有问题,麻烦尝试如下 demo

https://github.com/robinv8/taro-rn-webpack5-demo.git