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

项目重新yarn install后报错 Module not found: Can't resolve '@vue/server-renderer' #7708

Closed
linfun486 opened this issue Sep 24, 2020 · 4 comments · Fixed by #7776
Closed
Labels
F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@linfun486
Copy link

相关平台

微信小程序

复现仓库

https://github.com/linfun486/taro-2020.9.24-issue
小程序基础库: 2.13.0
使用框架: Vue 3

复现步骤

taro init 的vue3-vuex 就存在此问题

步骤1: taro init 然后选 Vue3/ ts[Y] / Sass / Gitee / vue3-vuex
步骤2: taro build --type weapp --watch

就报错了,项目中也是同样的错误

期望结果

能正常跑起来build

实际结果

生成 工具配置 /Users/linfuchuan/taro/test/dist/project.config.json

编译 发现入口 src/app.ts
编译 发现页面 src/pages/index/index.vue
🙅 编译失败.

./src/components/NumberDisplay.vue?vue&type=template&id=6aab00b9&bindings={"getNumbers":"setup"})
Module not found: Can't resolve '@vue/server-renderer' in '/Users/linfuchuan/taro/test/src/components'

监听文件修改中...

./src/components/NumberDisplay.vue?vue&type=template&id=6aab00b9&bindings={"getNumbers":"setup"} (./node_modules/@tarojs/mini-runner/node_modules/babel-loader/lib!./node_modules/vue-loader/dist/templateLoader.js??ref--6!./node_modules/vue-loader/dist??ref--10-0!./src/components/NumberDisplay.vue?vue&type=template&id=6aab00b9&bindings={"getNumbers":"setup"})
Module not found: Error: Can't resolve '@vue/server-renderer' in '/Users/linfuchuan/taro/test/src/components'
resolve '@vue/server-renderer' in '/Users/linfuchuan/taro/test/src/components'
。。。。

环境信息

Taro CLI 3.0.11 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.22.1 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 6.14.6 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.11 => 3.0.11 
      @tarojs/mini-runner: 3.0.11 => 3.0.11 
      @tarojs/runtime: 3.0.11 => 3.0.11 
      @tarojs/taro: 3.0.11 => 3.0.11 
      @tarojs/webpack-runner: 3.0.11 => 3.0.11 
      babel-preset-taro: 3.0.11 => 3.0.11 
      eslint-config-taro: 3.0.11 => 3.0.11 

补充信息

在2020.9.14 通过3.0.10 完成init 没有任何问题,但是昨天(2020.9.23)想打包发线上预览报错,getCurrentInstance获取到的ctx 与开发环境不一致,于是想reinstall,于是出现这个错误,尝试过3.0.9, 3.0.10, 3.0.11都是相同的情况,期间没有更改过package.json

怀疑taro相关的依赖更新后产生的问题。

@taro-bot2 taro-bot2 bot added F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 24, 2020
@KangChangYi
Copy link
Contributor

我这边运行起来错误和你不一样,我报错是:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'isSupportRecursivendefined
    at new TaroMiniPlugin (G:\workspace\taro-2020.9.24-issue\node_modules\@tarojs\mini-runner\src\s\MiniPlugin.ts:121:18)

是 9月15号 关于 mini-runner 的一个 fix 导致的。
e67f083#diff-919e0049eb392798127c45edd6b76a0c

@b2nil
Copy link
Collaborator

b2nil commented Sep 24, 2020

+1
使用 @tarojs/cli 新建的项目(typescript + vue 3.0),报相同的错误 Module not found: Can't resolve '@vue/server-renderer'

@zhaoguoweiLLHC
Copy link
Contributor

image

新版@vue/compiler-sfc导致的问题,把@vue/compiler-sfc vue-loader这两个包的^去掉,锁定版本,重新安装即可

@linfun486
Copy link
Author

已解决,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants