执行报错:
LdeMacBook-Pro:umi4 liyanru$ umi block add TableList
Warning: Please use require("react-router").matchPath instead of require("react-router/matchPath"). Support for the latter will be removed in the next major release.
Warning: Please use require("react-router").Router instead of require("react-router/Router"). Support for the latter will be removed in the next major release.
Warning: Please use require("react-router").Switch instead of require("react-router/Switch"). Support for the latter will be removed in the next major release.
Warning: Please use require("react-router").Route instead of require("react-router/Route"). Support for the latter will be removed in the next major release.
✔ Parse url and args
✔ Git fetch
✔ Git checkout master
✔ Git pull
✖ error AssertionError [ERR_ASSERTION]: /Users/liyanru/.umi/blocks/github.com/ant-design/pro-blocks/TableList don't exists
at /Users/liyanru/Documents/svn/cmsTemplate/trunk/umi4/node_modules/umi-build-dev/lib/plugins/commands/block/index.js:246:27
at Generator.next (
at asyncGeneratorStep (/Users/liyanru/Documents/svn/cmsTemplate/trunk/umi4/node_modules/umi-build-dev/lib/plugins/commands/block/index.js:38:103)
at _next (/Users/liyanru/Documents/svn/cmsTemplate/trunk/umi4/node_modules/umi-build-dev/lib/plugins/commands/block/index.js:40:194)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
umi block add ant-design-pro/TableList 也报同样的错
umi block add TableList 这样用
LdeMacBook-Pro:umi4 liyanru$ umi -v
2.7.0
umi block add TableList 好像和楼主的用法没什么区别。
看着很奇怪。
试了几个都不行
block 应该也没写错
LdeMacBook-Pro:umi4 liyanru$ umi block list
Warning: Please use require("react-router").matchPath instead of require("react-router/matchPath"). Support for the latter will be removed in the next major release.
Warning: Please use require("react-router").Router instead of require("react-router/Router"). Support for the latter will be removed in the next major release.
Warning: Please use require("react-router").Switch instead of require("react-router/Switch"). Support for the latter will be removed in the next major release.
Warning: Please use require("react-router").Route instead of require("react-router/Route"). Support for the latter will be removed in the next major release.
Blocks:
ant-design-pro/AccountCenter
ant-design-pro/AccountSettings
ant-design-pro/AdvancedForm
ant-design-pro/AdvancedProfile
ant-design-pro/Analysis
ant-design-pro/BasicForm
ant-design-pro/BasicList
ant-design-pro/BasicProfile
ant-design-pro/CardList
ant-design-pro/Exception403
ant-design-pro/Exception404
ant-design-pro/Exception500
ant-design-pro/Monitor
ant-design-pro/ResultFail
ant-design-pro/ResultSuccess
ant-design-pro/SearchListApplications
ant-design-pro/SearchListArticles
ant-design-pro/SearchListProjects
ant-design-pro/StepForm
ant-design-pro/TableList
ant-design-pro/UserLogin
ant-design-pro/UserRegister
ant-design-pro/UserRegisterResult
ant-design-pro/Workplace
blank
demo-with-dependencies
demo
user-dashboard
这个也不行
LdeMacBook-Pro:umi4 liyanru$ umi block add https://github.com/umijs/umi-blocks/tree/master/TableList
应该是 npx umi block add ListTableList --path=/list/table-list

umi block list 有问题@chenshuai2144 要统一一下调用方式。
如果能支持多级目录会好一点,现在add后 目录结构并不友好
--path=/list/table-list
--path=/list/table-list 确实可以,文档里的说明再清晰一点可能会更好,看文档的第一印象觉得path只是设置路由
LdeMacBook-Pro:umi4 liyanru$ umi block add EditorKoni --path=/Editor/Koni
执行结果
{
name: 'koni',
path: '/editor/koni',
component: './Editor/Koni',
},
- --path=/Editor/Koni
+ --to Editor/Koni
这个参数改成这样比较好理解,也看着比较易读。
@yutingzhao1991
npx umi block add UserLogin --path=/user/login 报错
我把路由配置写在router.config.ts中,执行block命令,报如下错误,改为router.config.js在执行就好了

@zywkuo 这个可能是 umi 区块的一个 bug,找路由文件的时候没有考虑 ts,可以建个 issue 到 umi。
这个参数改成这样比较好理解,也看着比较易读。
嗯,to 感觉确实清晰些。

try use npx umi block list
try use
npx umi block list
开始安装了,但是遇到的麻烦太多了。
Parse url and args
✔ 🚒 Git fetch
✔ 🚛 Git checkout master
✔ 🚀 Git pull
✖ 📦 Install additional dependencies ant-design-pro@^2.1.1,numeral@^2.0.6 with npm --registry https://registry.npm.taobao.org
✖ error Error: Error: Command failed: npm install ant-design-pro@^2.1.1 numeral@^2.0.6 --registry=https://registry.npm.taobao.org --save
npm WARN @typescript-eslint/[email protected] requires a peer of @typescript-eslint/parser@^1.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/[email protected] requires a peer of eslint@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-react@^7.14.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^4.19.1 || ^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-import@^2.17.2 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/[email protected] requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/[email protected] requires a peer of eslint@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^4.19.1 || ^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-import@^2.18.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-jsx-a11y@^6.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-react@^7.14.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^4.19.1 || ^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-import@^2.17.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 6.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@>=4.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^3 || ^4 || ^5 || ^6 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of stylelint@^8.3.0 || ^9.0.0 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/[email protected] requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/[email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>=15.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@>=15.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0-rc || ^16.0.0-rc || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^0.14.0 || ^15.0.0-rc || ^16.0.0-rc || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>=15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@>=15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0-rc || ^16.0.0-rc || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^0.14.0 || ^15.0.0-rc || ^16.0.0-rc || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/[email protected] requires a peer of prop-types@^15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/[email protected] requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>=15.0.0 but none is installed. You must install peer dependencies yourself.
执行umi block add ant-design-pro/flow 会遇到类似的错误,检查目录下确实没有对应的文件夹
umi版本是2.12.9
✔ 😁 Parse url and args
✔ 🚒 Git fetch
⠋ 🚛 Git checkout masterAlready on 'master'
Your branch is up to date with 'origin/master'.
✔ 🚛 Git checkout master
⠸ 🚀 Git pullAlready up to date.
✔ 🚀 Git pull
✖ error AssertionError [ERR_ASSERTION]: /Users/mabiao/.umi/blocks/github.com/umijs/umi-blocks/EditorFlow don't exists
at /Volumes/Samsung_T5/Src/front-end/node_modules/umi-build-dev/lib/plugins/commands/block/addBlock.js:262:27
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Volumes/Samsung_T5/Src/front-end/node_modules/umi-build-dev/lib/plugins/commands/block/addBlock.js:129:103)
at _next (/Volumes/Samsung_T5/Src/front-end/node_modules/umi-build-dev/lib/plugins/commands/block/addBlock.js:131:194)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
检查对应目录:
ls ~/.umi/blocks/github.com/umijs/umi-blocks
LICENSE README.md _scripts blocks jsconfig.json now.json package.json plugin.js templates tsconfig.json tslint.json
shall we reopen this issue?
应该是
npx umi block add ListTableList --path=/list/table-list
问下preview页面的这个复制命令的东西为什么不见了?
I got it working by adding the full path of the block from the list of blocks after umi block add. e.g. umi block add https://github.com/ant-design/pro-blocks/tree/master/UserRegisterResult