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

(node:2632) UnhandledPromiseRejectionWarning: TypeError: templateFn is not a function #8385

Closed
guyueping opened this issue Dec 28, 2020 · 4 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@guyueping
Copy link

相关平台

微信小程序

复现仓库

https://github.com/guyueping/merchant_wap.git
小程序基础库: 2.24.1
使用框架: React

复现步骤

编译报错

期望结果

编译不报错

实际结果

正在编译...templateFn is not a function

templateFn is not a function

(node:2632) UnhandledPromiseRejectionWarning: TypeError: templateFn is not a function
at TaroMiniPlugin.generateTemplateFile (/Users/gyp/myWeb/yipin/merchant_wap/node_modules/@tarojs/mini-runner/src/plugins/MiniPlugin.ts:706:20)
at TaroMiniPlugin. (/Users/gyp/myWeb/yipin/merchant_wap/node_modules/@tarojs/mini-runner/src/plugins/MiniPlugin.ts:649:10)
at Generator.next ()
at fulfilled (/Users/gyp/myWeb/yipin/merchant_wap/node_modules/@tarojs/mini-runner/dist/plugins/MiniPlugin.js:5:58)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:2632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

环境信息

👽 Taro v3.0.18

process.env.NODE_ENV>> undefined
process.env.TARO_ENV>>> undefined

  Taro CLI 3.0.18 environment info:
    System:
      OS: macOS 10.15.7
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.18.2 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.18 => 3.0.18 
      @tarojs/mini-runner: ^3.0.18 => 3.0.21 
      @tarojs/react: 3.0.18 => 3.0.18 
      @tarojs/runtime: 3.0.18 => 3.0.18 
      @tarojs/taro: 3.0.18 => 3.0.18 
      @tarojs/webpack-runner: 3.0.18 => 3.0.18 
      babel-preset-taro: 3.0.18 => 3.0.18 
      eslint-config-taro: 3.0.18 => 3.0.18 
      nervjs: ^1.5.7 => 1.5.7 
      react: ^16.10.0 => 16.14.0 
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.7 
    npmGlobalPackages:
      typescript: 3.5.3
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Dec 28, 2020
@guyueping
Copy link
Author

版本问题,@tarojs/mini-runner (3.0.21) 与当前使用的 Taro CLI (3.0.18) 版本不一致,统一更新成3.0.18就可以了
不过,为什么这种小版本的也不兼容呢,,,

@luckyadam
Copy link
Member

CLI 本来就要是要与项目依赖版本保持一致,请统一更新到 3.0.21

@icepy
Copy link

icepy commented Dec 29, 2020

@luckyadam 请问一下 CLI 和项目依赖版本都是 3.0.21 ,但依然是 (node:85863) UnhandledPromiseRejectionWarning: TypeError: templateFn is not a function ,这个怎么解决?

环境信息

👽 Taro v3.0.21

"dependencies": {
    "@babel/runtime": "^7.7.7",
    "@tarojs/components": "3.0.21",
    "@tarojs/runtime": "3.0.21",
    "@tarojs/taro": "3.0.21",
    "@tarojs/react": "3.0.21",
    "react-dom": "^16.10.0",
    "react": "^16.10.0"
  },
  "devDependencies": {
    "@types/webpack-env": "^1.13.6",
    "@types/react": "^16.0.0",
    "@tarojs/mini-runner": "3.0.21",
    "@babel/core": "^7.8.0",
    "@tarojs/webpack-runner": "3.0.21",
    "babel-preset-taro": "3.0.21",
    "eslint-config-taro": "3.0.21",
    "eslint": "^6.8.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react-hooks": "^1.6.1",
    "stylelint": "9.3.0",
    "@typescript-eslint/parser": "^2.x",
    "@typescript-eslint/eslint-plugin": "^2.x",
    "typescript": "^3.7.0"
  }

@zl1437
Copy link

zl1437 commented Jan 6, 2021

还是存在这个问题啊 已经更新到同一版本了

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-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

4 participants