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

taro 2.2.17 init模板编译报错 #9036

Open
wangruiStart opened this issue Apr 6, 2021 · 13 comments
Open

taro 2.2.17 init模板编译报错 #9036

wangruiStart opened this issue Apr 6, 2021 · 13 comments
Assignees
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-2 Version - 2.x

Comments

@wangruiStart
Copy link

相关平台

微信小程序

小程序基础库: 2.16.0
使用框架: React

复现步骤

taro cli版本升级至 2.2.17
taro init demo
npm run dev:weapp

期望结果

编译成功

实际结果

👽 Taro v2.2.17

生成 工具配置 /Users/wangrui/Desktop/未命名文件夹/weixin/dist/project.config.json
(node:12487) UnhandledPromiseRejectionWarning: Error: Cannot find module 'core-js/modules/es.string.replace.js'
Require stack:

  • /Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/csso-webpack-plugin/lib/index.js
  • /Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/@tarojs/mini-runner/dist/webpack/chain.js
  • /Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/@tarojs/mini-runner/dist/webpack/build.conf.js
  • /Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/@tarojs/mini-runner/dist/index.js
  • /Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/@tarojs/mini-runner/index.js
  • /usr/local/lib/node_modules/@tarojs/cli/node_modules/_@[email protected]@@tarojs/helper/dist/npm.js
  • /usr/local/lib/node_modules/@tarojs/cli/node_modules/_@[email protected]@@tarojs/helper/dist/index.js
  • /usr/local/lib/node_modules/@tarojs/cli/node_modules/_@[email protected]@@tarojs/helper/index.js
  • /usr/local/lib/node_modules/@tarojs/cli/dist/util/index.js
  • /usr/local/lib/node_modules/@tarojs/cli/bin/taro
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (/Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/csso-webpack-plugin/lib/index.js:6:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module._compile (/usr/local/lib/node_modules/@tarojs/cli/node_modules/_pirates@4.0.1@pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.newLoader [as .js] (/usr/local/lib/node_modules/@tarojs/cli/node_modules/_pirates@4.0.1@pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (/Users/wangrui/Desktop/未命名文件夹/weixin/node_modules/@tarojs/mini-runner/dist/webpack/chain.js:7:31)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module._compile (/usr/local/lib/node_modules/@tarojs/cli/node_modules/_pirates@4.0.1@pirates/lib/index.js:99:24)
    (Use node --trace-warnings ... to show where the warning was created)
    (node:12487) 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:12487) [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 v2.2.17


  Taro CLI 2.2.17 environment info:
    System:
      OS: macOS 11.2.3
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.15.1 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.14.8 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 2.2.17 => 2.2.17 
      @tarojs/components-qa: 2.2.17 => 2.2.17 
      @tarojs/mini-runner: 2.2.17 => 2.2.17 
      @tarojs/plugin-less: 2.2.10 => 2.2.10 
      @tarojs/plugin-terser: 2.2.17 => 2.2.17 
      @tarojs/redux: 2.2.17 => 2.2.17 
      @tarojs/redux-h5: 2.2.17 => 2.2.17 
      @tarojs/router: 2.2.17 => 2.2.17 
      @tarojs/taro: 2.2.17 => 2.2.17 
      @tarojs/taro-alipay: 2.2.17 => 2.2.17 
      @tarojs/taro-h5: 2.2.17 => 2.2.17 
      @tarojs/taro-qq: 2.2.17 => 2.2.17 
      @tarojs/taro-quickapp: 2.2.17 => 2.2.17 
      @tarojs/taro-rn: 2.2.17 => 2.2.17 
      @tarojs/taro-swan: 2.2.17 => 2.2.17 
      @tarojs/taro-tt: 2.2.17 => 2.2.17 
      @tarojs/taro-weapp: 2.2.17 => 2.2.17 
      @tarojs/webpack-runner: 2.2.17 => 2.2.17 
      eslint-config-taro: 2.2.17 => 2.2.17 
      eslint-plugin-taro: 2.2.17 => 2.2.17 
      nerv-devtools: ^1.5.5 => 1.5.7 
      nervjs: ^1.5.5 => 1.5.7 
      stylelint-config-taro-rn: 2.2.17 => 2.2.17 
      stylelint-taro-rn: 2.2.17 => 2.2.17 
    npmGlobalPackages:
      typescript: 2.6.1
@taro-bot2
Copy link

taro-bot2 bot commented Apr 6, 2021

您的 Issue 没有按照规范从 Taro Issue Helper 创建,因此会被直接关闭。

维护开源项目是一项非常辛苦的工作,还请多多包涵。
了解为什么这么严格?

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-2 Version - 2.x labels Apr 6, 2021
@jeft224
Copy link

jeft224 commented Apr 7, 2021

@wangruiStart 还有其他的解决方案不

@taichenglu
Copy link

我刚从 2.2.15 升级到 2.2.17 也报这个错

@taichenglu
Copy link

结果悲剧了,再切回 2.2.15 也是报这个错。又要折腾了。。。

@jeft224
Copy link

jeft224 commented Apr 7, 2021

@taichenglu 我2.2.15 一直打包失败

@wangruiStart
Copy link
Author

@wangruiStart 还有其他的解决方案不

安装 core-js 依赖可以临时解决问题。

@jeft224
Copy link

jeft224 commented Apr 7, 2021

@wangruiStart 我安装了core-js好像不行

@taichenglu
Copy link

结果悲剧了,再切回 2.2.15 也是报这个错。又要折腾了。。。

@taichenglu
Copy link

突然想到从其他项目把 node_modules 拷过来用,居然可以了,暂时用回 2.2.15

@jeft224
Copy link

jeft224 commented Apr 7, 2021

@wangruiStart 我装的core-js版本太低了,装core-js暂时可以解决,谢谢啦

@taichenglu
Copy link

安装了core-js 解决问题,多谢

@ksora94
Copy link

ksora94 commented Apr 7, 2021

版本升级遇到了同样的问题,希望官方尽快解决!

@luckyadam luckyadam self-assigned this Apr 8, 2021
@superWendell
Copy link

安装了core-js 如果没有效果,说明你安装的不是3.0以上版本, npm i core-js@3 可以

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

No branches or pull requests

6 participants