taro icon indicating copy to clipboard operation
taro copied to clipboard

更新至2.2.9编译失败

Open tiandezhen opened this issue 6 years ago • 3 comments

问题描述

更新到2.2.9后执行 npm run dev:weapp 报编译错误

复现步骤

  1. 执行 npm run dev:weapp
  2. 错误信息如下:

Taro v2.2.9

(node:36796) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time 生成 工具配置 /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/dist/project.config.json (node:36796) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'lessLoaderOption' of undefined at /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/@tarojs/plugin-less/dist/index.js:22:53 at Generator.next () at /Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/@tarojs/plugin-less/dist/index.js:8:71 at new Promise () at __awaiter (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/@tarojs/plugin-less/dist/index.js:4:12) at Object.fn (/Users/noock/Projects/SoHealth/src/tdz.app.sohealth.terminal/node_modules/@tarojs/plugin-less/dist/index.js:13:43) at Kernel. (/usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:199:48) 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 /usr/local/lib/node_modules/@tarojs/cli/node_modules/@[email protected]@@tarojs/service/dist/Kernel.js:198:33 at eval (eval at create (/usr/local/lib/node_modules/@tarojs/cli/node_modules/[email protected]@tapable/lib/HookCodeFactory.js:74:10), :48:17) at new Promise () at AsyncSeriesWaterfallHook.eval [as promise] (eval at create (/usr/local/lib/node_modules/@tarojs/cli/node_modules/[email protected]@tapable/lib/HookCodeFactory.js:74:10), :2:8) at AsyncSeriesWaterfallHook.lazyCompileHook (/usr/local/lib/node_modules/@tarojs/cli/node_modules/[email protected]@tapable/lib/Hook.js:154:20) (node:36796) 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:36796) [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 👽 Taro v2.2.9

(node:36816) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time

Taro CLI 2.2.9 environment info: System: OS: macOS 10.15.5 Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.8.0 - /usr/local/bin/node npm: 6.14.5 - /usr/local/bin/npm npmPackages: @tarojs/components: 2.2.9 => 2.2.9 @tarojs/components-qa: 2.2.9 => 2.2.9 @tarojs/mini-runner: 2.2.9 => 2.2.9 @tarojs/plugin-less: 2.2.9 => 2.2.9 @tarojs/plugin-sass: 2.2.9 => 2.2.9 @tarojs/plugin-stylus: 2.2.9 => 2.2.9 @tarojs/router: 2.2.9 => 2.2.9 @tarojs/taro: 2.2.9 => 2.2.9 @tarojs/taro-alipay: 2.2.9 => 2.2.9 @tarojs/taro-h5: 2.2.9 => 2.2.9 @tarojs/taro-qq: 2.2.9 => 2.2.9 @tarojs/taro-quickapp: 2.2.9 => 2.2.9 @tarojs/taro-rn: 2.2.9 => 2.2.9 @tarojs/taro-swan: 2.2.9 => 2.2.9 @tarojs/taro-tt: 2.2.9 => 2.2.9 @tarojs/taro-weapp: 2.2.9 => 2.2.9 @tarojs/webpack-runner: 2.2.9 => 2.2.9 eslint-config-taro: 2.2.9 => 2.2.9 eslint-plugin-taro: 2.2.9 => 2.2.9 nerv-devtools: ^1.5.7 => 1.5.7 nervjs: ^1.5.7 => 1.5.7 stylelint-config-taro-rn: 2.2.9 => 2.2.9 stylelint-taro-rn: 2.2.9 => 2.2.9 taro-ui: ^2.2.4 => 2.3.4 npmGlobalPackages: typescript: 3.7.3

tiandezhen avatar Jun 28 '20 08:06 tiandezhen

如果是从 1.x 升级上来的话,请先按照迁移指南修改一下项目的编译配置 https://nervjs.github.io/taro/docs/migrate-to-2

luckyadam avatar Jun 29 '20 14:06 luckyadam

非常感谢,上面的链接已经失效,按下面的链接配置的: https://nervjs.github.io/taro/docs/2.2.8/migrate-to-2/ 配置完之后可以开始编译,每个页面都过了,最后一步编译时失败: 编译 发现页面 src/pages/my/favouriteType.tsx ⠧ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of "unknown" as it exceeds the max of "500KB". 🙅 编译失败.

./node_modules/taro-ui/dist/style/index.scss 6:0 Module parse failed: Unexpected character '@' (6:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | | /* Variables */

@import './variables/default.scss'; | | /* Mixin */

是Babel哪儿配置不对?

tiandezhen avatar Jul 01 '20 05:07 tiandezhen

配置里plugin增加

'@tarojs/plugin-sass',

就好了 搞定

tiandezhen avatar Jul 01 '20 05:07 tiandezhen