[go: nahoru, domu]

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

微信小程序转 Taro报错 #16071

Closed
KrisLan95 opened this issue Jul 8, 2024 · 1 comment
Closed

微信小程序转 Taro报错 #16071

KrisLan95 opened this issue Jul 8, 2024 · 1 comment
Labels
A-taroize Area - Taro convert 相关

Comments

@KrisLan95
Copy link

相关平台

微信小程序

小程序基础库: 2.33.0
使用框架: React

复现步骤

反向转换步骤#
安装 Taro 命令行工具:
$ npm i -g @tarojs/cli
在微信小程序项目的根目录中运行 convert 命令进行转换:

转换后的代码保存在根目录下的 taroConvert 文件夹下

$ taro convert

执行以上步骤,报以下错误,请问是什么原因导致的?报错信息如下:
lanzhiqiu@KrisMacBook-Pro AmemberClientTaro % taro convert
👽 Taro v3.6.32

✔ 获取 taro 全局配置成功
/Users/lanzhiqiu/.nvm/versions/node/v20.10.0/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:306
throw new Error(${name} 命令不存在);
^

Error: convert 命令不存在
at Kernel. (/Users/lanzhiqiu/.nvm/versions/node/v20.10.0/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/src/Kernel.ts:362:13)
at Generator.next ()
at fulfilled (/Users/lanzhiqiu/.nvm/versions/node/v20.10.0/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.10.0

期望结果

期望不报错,命令正常执行,完成转换。谢谢。

实际结果

出现了报错,报错信息如下:
lanzhiqiu@KrisMacBook-Pro .taro3.6-rs % taro convert
👽 Taro v3.6.32

⚠ 获取 taro 全局配置文件失败,不存在全局配置文件:/Users/lanzhiqiu/.taro-global-config/index.json
/Users/lanzhiqiu/.nvm/versions/node/v20.10.0/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:306
throw new Error(${name} 命令不存在);
^

Error: convert 命令不存在
at Kernel. (/Users/lanzhiqiu/.nvm/versions/node/v20.10.0/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/src/Kernel.ts:362:13)
at Generator.next ()
at fulfilled (/Users/lanzhiqiu/.nvm/versions/node/v20.10.0/lib/node_modules/@tarojs/cli/node_modules/@tarojs/service/dist/Kernel.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.10.0

环境信息

Taro CLI 3.6.32 environment info:
    System:
      OS: macOS 15.0
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
      Yarn: 1.22.21 - /opt/homebrew/bin/yarn
      npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.32 => 3.6.32 
      @tarojs/components: 3.6.32 => 3.6.32 
      @tarojs/helper: 3.6.32 => 3.6.32 
      @tarojs/plugin-framework-react: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-alipay: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-h5: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-jd: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-qq: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-swan: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-tt: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-weapp: 3.6.32 => 3.6.32 
      @tarojs/react: 3.6.32 => 3.6.32 
      @tarojs/runtime: 3.6.32 => 3.6.32 
      @tarojs/shared: 3.6.32 => 3.6.32 
      @tarojs/taro: 3.6.32 => 3.6.32 
      @tarojs/taro-loader: 3.6.32 => 3.6.32 
      @tarojs/webpack5-runner: 3.6.32 => 3.6.32 
      babel-preset-taro: 3.6.32 => 3.6.32 
      eslint-config-taro: 3.6.32 => 3.6.32 
      react: ^18.0.0 => 18.3.1 
@TheKonka TheKonka added the A-taroize Area - Taro convert 相关 label Jul 8, 2024
@qingchuan01
Copy link

用错命令了。
taro 3.x,不是用 taro convert,这个命令不在 tarojs/cli 中,是单独的包。
用:

# 转换后的代码保存在根目录下的 `taroConvert` 文件夹下
$ npx @tarojs/cli-convertor

文档:微信小程序转 Taro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-taroize Area - Taro convert 相关
Projects
None yet
Development

No branches or pull requests

4 participants