Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.7 小程序预览、真机预览 总是提示 错误 #16806

Open
yanwuguangjun opened this issue Nov 4, 2024 · 2 comments
Open

4.0.7 小程序预览、真机预览 总是提示 错误 #16806

yanwuguangjun opened this issue Nov 4, 2024 · 2 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-4 Version - 4.x

Comments

@yanwuguangjun
Copy link

相关平台

微信小程序

复现仓库

https://gitee.com/studytank/preview_error.git
小程序基础库: 3.6.3
使用框架: React

复现步骤

预览 Error: Error: Cannot find module 'nanoid/non-secure'
Require stack:

  • E:\tuo_q\bluetooth_new\invoice\node_modules\postcss\lib\input.js
  • E:\tuo_q\bluetooth_new\invoice\node_modules\postcss\lib\fromJSON.js
  • E:\tuo_q\bluetooth_new\invoice\node_modules\postcss\lib\postcss.js

安装此模块后仍然 有错误

期望结果

正常预览

实际结果

无法预览

环境信息

👽 Taro v4.0.7


  Taro CLI 4.0.7 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 20.12.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.21 - C:\Program Files\nodejs\yarn.CMD
      npm: 7.9.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.0.7 => 4.0.7
      @tarojs/components: 4.0.7 => 4.0.7
      @tarojs/helper: 4.0.7 => 4.0.7
      @tarojs/plugin-framework-react: 4.0.7 => 4.0.7
      @tarojs/plugin-html: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-alipay: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-h5: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-jd: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-qq: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-swan: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-tt: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-weapp: 4.0.7 => 4.0.7
      @tarojs/react: 4.0.7 => 4.0.7
      @tarojs/runtime: 4.0.7 => 4.0.7
      @tarojs/shared: 4.0.7 => 4.0.7
      @tarojs/taro: 4.0.7 => 4.0.7
      @tarojs/taro-loader: 4.0.7 => 4.0.7
      @tarojs/webpack5-runner: 4.0.7 => 4.0.7
      babel-preset-taro: 4.0.7 => 4.0.7
      eslint-config-taro: 4.0.7 => 4.0.7
      react: ^18.0.0 => 18.3.1

补充信息

taro 3.6.2 升级到 4.0.7 后项目也升级到了 4.0.7

@yanwuguangjun
Copy link
Author

安装nanoid 后 提示
预览 Error: Error [ERR_REQUIRE_ESM]: require() of ES Module E:\tuo_q\bluetooth_new\invoice\node_modules\nanoid\non-secure\index.js from E:\tuo_q\bluetooth_new\invoice\node_modules\postcss\lib\input.js not supported. Instead change the require of index.js in E:\tuo_q\bluetooth_new\invoice\node_modules\postcss\lib\input.js to a dynamic import() which is available in all CommonJS modules.

@yanwuguangjun
Copy link
Author

微信开发工具中预览没有问题, 真机预览或者调试会提示错误

@TheKonka TheKonka added F-react Framework - React T-weapp Target - 编译到微信小程序 V-4 Version - 4.x labels Nov 4, 2024
This was referenced Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-4 Version - 4.x
Projects
Status: Todo
Development

No branches or pull requests

2 participants