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

默认初始化 #8220

Closed
i-coder-robot opened this issue Dec 8, 2020 · 2 comments
Closed

默认初始化 #8220

i-coder-robot opened this issue Dec 8, 2020 · 2 comments
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@i-coder-robot
Copy link

相关平台

微信小程序

复现仓库

https://github.com/i-coder-robot/taro3WeappVue.git
小程序基础库: 2.14.1
使用框架: Vue 2

复现步骤

taro init xxx,选择vue,初始化结束后,进入项目目录,运行yarn dev:weapp,报错

期望结果

运行成功

实际结果

抛错

环境信息

👽 Taro v3.0.18


  Taro CLI 3.0.18 environment info:
    System:
      OS: macOS 10.15.4
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 14.14.0 - /usr/local/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.8 - /usr/local/bin/npm

@taro-bot2 taro-bot2 bot added F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Dec 8, 2020
@fangmd
Copy link

fangmd commented Dec 11, 2020

默认初始化运行不了。

node-sass 也有问题, 需要执行 npm rebuild node-sass

然后遇到这个:

node:internal/modules/cjs/loader:919
  const err = new Error(message);
              ^

Error: Cannot find module '../build/Release/canvas.node'

@Chen-jj
Copy link
Contributor

Chen-jj commented Dec 21, 2020

@fangmd 看了下 taro-ui-vue 被引用的是 src 下的源码,Typescript 写的。而你建的是非 TS 的工程,所以编译报错。你可以把 babel.config.js 中,taro preset 的 typescript 选项置为 true 即可,taro 会帮你加上 babel 解析 typescript 的 plugin。

// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
  presets: [
    ['taro', {
      framework: 'vue',
      ts: true
    }]
  ]
}

node-sass 的问题自行解决吧,非 taro 问题。

@Chen-jj Chen-jj closed this as completed Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

3 participants