taro icon indicating copy to clipboard operation
taro copied to clipboard

Taro2.1.5更新到2.2.3后无法编译

Open tiandezhen opened this issue 6 years ago • 8 comments

问题描述

从2.1.5更新到2.2.3版本后执行了, taro update self 然后taro就不能编译也不能执行了

复现步骤

  1. taro update project, 或 taro update self, 或 npm run dev:weapp 执行报错信息如下:

👽 Taro v2.2.3

(node:77035) UnhandledPromiseRejectionWarning: TypeError: items.forEach is not a function at /usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/utils/index.js:17:15 at /usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/utils/index.js:33:51 at Kernel.initPresetsAndPlugins (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:72:107) at Kernel. (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:40:18) at Generator.next () at /usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:8:71 at new Promise () at __awaiter (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:4:12) at Kernel.init (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:36:16) at Kernel. (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:239:24) (node:77035) 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: 2) (node:77035) [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 info 无法输出信息,报错与上面相同

tiandezhen avatar May 07 '20 06:05 tiandezhen

CC @luckyadam

taro-bot avatar May 07 '20 06:05 taro-bot

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

taro-bot avatar May 07 '20 06:05 taro-bot

遇到同样的问题,我从2.1.6更新上来的,从2.2.3一个版本一个版本回退,直到2.2.0都是有问题的,回退到2.1.6就没问题。 macOS 10.15.4 node v14.1.0 npm 6.14.4

li-jun avatar May 07 '20 07:05 li-jun

我也是遇到同样的问题,现在所有taro命令都用不了。。请问一下怎么回退版本?

NotMeIsMe avatar May 07 '20 07:05 NotMeIsMe

https://nervjs.github.io/taro/docs/config-detail.html#plugins 多看看文档, plugins 是个数组,如果你没有插件,就去掉

luckyadam avatar May 07 '20 08:05 luckyadam

index.js 文件中去掉plugins节点,原来是这样的:

plugins: {
    babel: {
      sourceMap: true,
      presets: [
        'env'
      ],
      plugins: [
        'transform-decorators-legacy',
        'transform-class-properties',
        'transform-object-rest-spread'
      ]
    }
  },

删除以后可以编译过了,但是自动监听文件时又报错

监听文件修改中...

Cannot read property 'hooks' of undefined

Cannot read property 'hooks' of undefined

(node:53919) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hooks' of undefined at Watching.handler (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/_@[email protected]@@tarojs/mini-runner/dist/index.js:50:33) at /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@webpack/lib/Watching.js:99:9 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@tapable/lib/HookCodeFactory.js:33:10), :22:1) at AsyncSeriesHook.lazyCompileHook (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@tapable/lib/Hook.js:154:20) at Watching._done (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@webpack/lib/Watching.js:98:28) at /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@webpack/lib/Watching.js:73:19 at Compiler.emitRecords (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@webpack/lib/Compiler.js:499:39) at /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@webpack/lib/Watching.js:54:20 at /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@webpack/lib/Compiler.js:485:14 at eval (eval at create (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/[email protected]@tapable/lib/HookCodeFactory.js:33:10), :10:1) at MiniPlugin. (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/@[email protected]@@tarojs/mini-runner/dist/plugins/MiniPlugin.js:109:17) at Generator.next () at fulfilled (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/@[email protected]@@tarojs/mini-runner/dist/plugins/MiniPlugin.js:5:58) (node:53919) 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:53919) [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.

tiandezhen avatar May 07 '20 12:05 tiandezhen

image cli 与项目依赖版本保持一致。。。

luckyadam avatar May 07 '20 15:05 luckyadam

又执行了下: taro update project 可以了,谢谢! 上次更新后失败,忘了更新项目了。

tiandezhen avatar May 08 '20 01:05 tiandezhen