Taro2.1.5更新到2.2.3后无法编译
问题描述
从2.1.5更新到2.2.3版本后执行了, taro update self 然后taro就不能编译也不能执行了
复现步骤
- 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.--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 无法输出信息,报错与上面相同
CC @luckyadam
欢迎提交 Issue~
如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏
如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。
Good luck and happy coding~
遇到同样的问题,我从2.1.6更新上来的,从2.2.3一个版本一个版本回退,直到2.2.0都是有问题的,回退到2.1.6就没问题。 macOS 10.15.4 node v14.1.0 npm 6.14.4
我也是遇到同样的问题,现在所有taro命令都用不了。。请问一下怎么回退版本?
https://nervjs.github.io/taro/docs/config-detail.html#plugins 多看看文档, plugins 是个数组,如果你没有插件,就去掉
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), --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.
cli 与项目依赖版本保持一致。。。
又执行了下: taro update project 可以了,谢谢! 上次更新后失败,忘了更新项目了。