ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.6k stars 8.15k forks source link

🐛[BUG]yarn create umi 报错,选JS的时候,试多次都报错 #6566

Closed kevinzl closed 4 years ago

kevinzl commented 4 years ago

🐛 bug 描述

📷 复现步骤

🏞 期望结果

💻 复现代码

© 版本信息

🚑 其他信息

kevinzl commented 4 years ago

$ yarn create umi yarn create v1.10.0 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@1.2.7: The platform "win32" is incompatible with this module. info "fsevents@1.2.7" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning "@vue/cli > @vue/cli-ui > vue-cli-plugin-apollo > ts-node@8.1.0" has unmet peer dependency "typescript@>=2.0". warning "umi > react-loadable@5.5.0" has unmet peer dependency "react@*". warning "umi > umi-build-dev > af-webpack > eslint-config-umi > eslint-config-react-app@3.0.8" has unmet peer dependency "babel-eslint@9.x". warning "umi > umi-build-dev > umi-test > jest > jest-cli > jest-config > jest-resolve@24.5.0" has unmet peer dependency "jest-haste-map@^24.0.0". warning "create-umi > sylvanas > @umijs/fabric > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "@typescript-eslint/parser@^1.9.0". [4/4] Building fresh packages...

success Installed "create-umi@0.23.1" with binaries:

SyntaxError: unknown: Unexpected token (24:12)

22 | }; 23 |

24 | export type { DefaultSettings }; | ^ 25 | 26 | export default proSettings; 27 | at Object.raise (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\ index.js:6975:17) at Object.unexpected (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser \lib\index.js:8368:16) at Object.parseIdentifierName (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@bab el\parser\lib\index.js:10327:18) at Object.parseIdentifier (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\p arser\lib\index.js:10305:23) at Object.tsParseTypeAliasDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modu les\@babel\parser\lib\index.js:5347:20) at Object.tsParseDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babe l\parser\lib\index.js:5664:23) at Object.tsTryParseExportDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modu les\@babel\parser\lib\index.js:5571:17) at Object.parseExportDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@ babel\parser\lib\index.js:6037:26) at Object.maybeParseExportDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modu les\@babel\parser\lib\index.js:11799:31) at Object.parseExport (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parse r\lib\index.js:11729:29) Emitted 'error' event at: at Immediate.setImmediate (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\yeoman-generator\lib\index.js: 415:18) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) error Command failed. Exit code: 1 Command: C:\Users\admin\AppData\Local\Yarn\bin\create-umi Arguments: Directory: F:\antd-pros Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

sibaiabis commented 4 years ago

用"cnpm create umi"即可解决

kevinzl commented 4 years ago

$ cnpm create umi ? Select the boilerplate type ant-design-pro ? �🤓 Which language do you want to use? JavaScript ? �🚀 Do you need all the blocks or a simple scaffold? simple ? �🦄 Time to use better, faster and latest antd@4! Yes Cloning into 'create'... remote: Enumerating objects: 188, done. remote: Counting objects: 100% (188/188), done. remote: Compressing objects: 100% (173/173), done. Rremote: Total 188 (delta 21), reused 58 (delta 8), pack-reused 0 Receiving objects: 100% (188/188), 296.16 KiB | 262.00 KiB/s, done. Resolving deltas: 100% (21/21), done.

�🚚 clone success [Sylvanas] Prepare js environment... events.js:187 throw er; // Unhandled 'error' event ^

SyntaxError: unknown: Unexpected token (24:12)

22 | }; 23 |

24 | export type { DefaultSettings }; | ^ 25 | 26 | export default proSettings; 27 | at Object.raise (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:6975:17) at Object.unexpected (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:8368:16) at Object.parseIdentifierName (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:10327:18) at Object.parseIdentifier (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:10305:23) at Object.tsParseTypeAliasDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:5347:20) at Object.tsParseDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:5664:23) at Object.tsTryParseExportDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:5571:17) at Object.parseExportDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:6037:26) at Object.maybeParseExportDeclaration (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:11799:31) at Object.parseExport (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\sylvanas\node_modules\@babel\parser\lib\index.js:11729:29) Emitted 'error' event on AntDesignProGenerator instance at: at Immediate. (C:\Users\admin\AppData\Local\Yarn\Data\global\node_modules\yeoman-generator\lib\index.js:415:18) at processImmediate (internal/timers.js:439:21) { pos: 464, loc: Position { line: 24, column: 12 }, code: 'BABEL_PARSE_ERROR' }

kevinzl commented 4 years ago

选TS不报错,选JS就会报错,用cnpm create umi 还是报错

sibaiabis commented 4 years ago

选TS不报错,选JS就会报错,用cnpm create umi 还是报错

js的话我没试,我用的ts,js待踩坑,hhhh

kevinzl commented 4 years ago

TS本身就是可以的,就是JS的不行试了好多次就是报错

ZhiJieZhang1 commented 4 years ago

有没有解决啊,我也碰到这个问题

ZhiJieZhang1 commented 4 years ago

最后一步不要选择新版的4.0就可以正常使用,只不过ant的库是3.2版本的,umi是2.x的

54zhanglin commented 4 years ago

xcode-select --install

ZhiJieZhang1 commented 4 years ago

xcode-select --install

更新到 11.4.1 ,还是报错啊

ZhiJieZhang1 commented 4 years ago

我找到问题了,是全局ts版本,安装3.6.3就可以了

chenshuai2144 commented 4 years ago

ts 需要3.8 的版本。不过推荐3.9 ,提升了性能

theDoinb commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

ZhiJieZhang1 commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

你把全局ts用yarn安装,版本选择3.6.3 其他的ts版本我没试过。还有babel,用yarn安装一下,babel这个是不是影响我没测试过,你安装上看能不能构建成功。

theDoinb commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

你把全局ts用yarn安装,版本选择3.6.3 其他的ts版本我没试过。还有babel,用yarn安装一下,babel这个是不是影响我没测试过,你安装上看能不能构建成功。

ts 全局升到3.9.2貌似不行..,不会要3.6.3吧,babel的话也要全局安装?

ZhiJieZhang1 commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

你把全局ts用yarn安装,版本选择3.6.3 其他的ts版本我没试过。还有babel,用yarn安装一下,babel这个是不是影响我没测试过,你安装上看能不能构建成功。

ts 全局升到3.9.2貌似不行..,不会要3.6.3吧,babel的话也要全局安装?

我刚测试了下,不需要全局babel,我当时只是把可能用到的全局包都从npm改到了yarn。 但是我现在全局安装3.9的ts也能构建了,可能你最好先删除全局ts,也可以删除create-ui重新yarn create umi ,但这次你最好先选择js

theDoinb commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

你把全局ts用yarn安装,版本选择3.6.3 其他的ts版本我没试过。还有babel,用yarn安装一下,babel这个是不是影响我没测试过,你安装上看能不能构建成功。

ts 全局升到3.9.2貌似不行..,不会要3.6.3吧,babel的话也要全局安装?

我刚测试了下,不需要全局babel,我当时只是把可能用到的全局包都从npm改到了yarn。 但是我现在全局安装3.9的ts也能构建了,可能你最好先删除全局ts,也可以删除create-ui重新yarn create umi ,但这次你最好先选择js

thank,删除create-ui后,重装可以了,可能是create-ui版本问题

ZhiJieZhang1 commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

你把全局ts用yarn安装,版本选择3.6.3 其他的ts版本我没试过。还有babel,用yarn安装一下,babel这个是不是影响我没测试过,你安装上看能不能构建成功。

ts 全局升到3.9.2貌似不行..,不会要3.6.3吧,babel的话也要全局安装?

我刚测试了下,不需要全局babel,我当时只是把可能用到的全局包都从npm改到了yarn。 但是我现在全局安装3.9的ts也能构建了,可能你最好先删除全局ts,也可以删除create-ui重新yarn create umi ,但这次你最好先选择js

thank,删除create-ui后,重装可以了,可能是create-ui版本问题

应该还是ts的问题,可能你之前出问题是先选择了ts版,create-umi缓存了自己的依赖包,反正那个错看着像ts解析有问题。

theDoinb commented 4 years ago

抛了同样的错误...,貌似 js 无论 npm, cnpm, yarn 都会抛,ts 倒是没问题

你把全局ts用yarn安装,版本选择3.6.3 其他的ts版本我没试过。还有babel,用yarn安装一下,babel这个是不是影响我没测试过,你安装上看能不能构建成功。

ts 全局升到3.9.2貌似不行..,不会要3.6.3吧,babel的话也要全局安装?

我刚测试了下,不需要全局babel,我当时只是把可能用到的全局包都从npm改到了yarn。 但是我现在全局安装3.9的ts也能构建了,可能你最好先删除全局ts,也可以删除create-ui重新yarn create umi ,但这次你最好先选择js

thank,删除create-ui后,重装可以了,可能是create-ui版本问题

应该还是ts的问题,可能你之前出问题是先选择了ts版,create-umi缓存了自己的依赖包,反正那个错看着像ts解析有问题。

想起来了,可能是的,之前好像pro4.0发布的时候,有在本地装过一个 ts 版

ty888 commented 4 years ago

有解决吗

yayxs commented 4 years ago

有解决吗

这个错误依然存在,语言选择 ts 的话好像没问题

yayxs commented 4 years ago

环境

选择模板

 Select the boilerplate type ant-design-pro
? � Be the first to experience the new umi@3 ? Pro V4
? � Which language do you want to use? JavaScript
? � Do you need all the blocks or a simple scaffold? simple
? � Time to use better, faster and latest antd@4! antd@4

结果(和上述错误信息大致一样)

> [Sylvanas] Prepare js environment...
events.js:291
      throw er; // Unhandled 'error' event
      ^

SyntaxError: unknown: Unexpected token (24:12)

  22 | };
  23 |
> 24 | export type { DefaultSettings };
     |             ^
  25 |
  26 | export default proSettings;
  27 |
    at Object.raise (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:7044:17)
    at Object.unexpected (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:8422:16)
    at Object.parseIdentifierName (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:10391:18)
    at Object.parseIdentifier (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:10369:23)
    at Object.tsParseTypeAliasDeclaration (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:5400:20)
    at Object.tsParseDeclaration (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:5723:23)
    at Object.tsTryParseExportDeclaration (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:5628:17)
    at Object.parseExportDeclaration (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:6106:26)
    at Object.maybeParseExportDeclaration (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:11869:31)
    at Object.parseExport (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\@babel\parser\lib\index.js:11799:29)
Emitted 'error' event on AntDesignProGenerator instance at:
    at Immediate.<anonymous> (C:\Users\666\AppData\Local\Yarn\Data\global\node_modules\yeoman-generator\lib\index.js:1007:20)
    at processImmediate (internal/timers.js:458:21) {
  pos: 436,
  loc: Position { line: 24, column: 12 },
  code: 'BABEL_PARSE_ERROR'
}
error Command failed.
Exit code: 1
Command: C:\Users\666\AppData\Local\Yarn\bin\create-umi