umi脚手架创建项目踩坑

作者: 不7而遇_ | 来源:发表于2019-06-25 17:08 被阅读0次

    今天要新建一个react 项目完成一个demo 这回我们用dva + umi 来写

    所以我们需要用umi.js 来创建一个项目

    npm create umi
    

    这里的选择可是一个大坑

    最开始是这样的,我们要创建一个app的项目 按 ↑↓都没有用 ,无法实现选择。我们需要在cmd 或者 gitbash 等终端手动把这个箭头更改到 app 的位置

    包括之后的 选择 ts 和 js 也需要这么修改

    ? Select the boilerplate type (Use arrow keys)
    ❯ ant-design-pro  - Create project with an layout-only ant-design-pro boilerplate, use together with umi block.
      app             - Create project with a simple boilerplate, support typescript.
      block           - Create a umi block.
      library         - Create a library with umi.
      plugin          - Create a umi plugin.
    

    这样选择成功后 我们创建的项目就是这个样子的。

    Did you mean this?
        repo
    
    ? Select the boilerplate type block
    ? What's the block name? (project)
                                      demo
    ? What's the block name? demo
    ? What's your block description?
    ? What's your block description?
    ? What's your email?
    ? What's your email?
    ? What's your name? Create a umi block.
    ? What's your name?
    ? Which repo is your block stored under github? (umijs/umi-blocks)
    ? Which repo is your block stored under github? umijs/umi-blocks
    ? Do you want to use typescript? (y/N) n
    ? Do you want to use typescript? No
       create package.json
       create .gitignore
       create .prettierignore
       create .prettierrc
       create .umirc.js
       create LICENSE
       create README.md
       create src\index.css
       create src\index.js
    ✨ File Generate Done
    
    

    此时我们就可以 安装依赖

    npm i
    

    然后可以启动项目

    npm start
    

    相关文章

      网友评论

        本文标题:umi脚手架创建项目踩坑

        本文链接:https://www.haomeiwen.com/subject/gsebnqtx.html