zoukankan      html  css  js  c++  java
  • yarn create umi报错

    根据ant-design-pro官网https://pro.ant.design/docs/getting-started-cn的安装提示,在项目目录下使用git命令运行yarn create umi,然后报错,报错的大概意思就是权限不足,

    $ yarn create umi
    yarn create v1.22.10
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info fsevents@1.2.11: The platform "win32" is incompatible with this module.
    info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
    [4/4] Building fresh packages...
    success Installed "create-umi@0.26.0" with binaries:
    - create-umi
    error An unexpected error occurred: "EPERM: operation not permitted, unlink 'C:\Program Files\nodejs\node_global\bin\create-next-app'".
    info If you think this is a bug, please open a bug report with the information provided in "C:\Users\86181\AppData\Local\Yarn\Data\global\yarn-error.log".
    info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

    然后使用管理员权限打开node,切换到目录下,重新运行yarn create umi,结果又报错了

    D:genuineadmin>yarn create umi
    yarn create v1.22.4
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info fsevents@1.2.11: The platform "win32" is incompatible with this module.
    info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
    [4/4] Building fresh packages...

    warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.22.4".
    info To upgrade, run the following command:
    $ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
    success Installed "create-umi@0.26.0" with binaries:
    - create-umi
    'C:Program' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    error Command failed.
    Exit code: 1
    Command: C:Program Files odejs ode_globalincreate-umi
    Arguments:
    Directory: D:genuineadmin
    Output:

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

    这里提示我的yarn版本低了,先升级yarn版本,可以使用npm i yarn@latest -g来安装最新版本的yarn

    但是升级后再次运行,还是报错,报错内容后上面一样,只是没报yarn版本的错误

    在网上搜了下,说修改create-umi.cmd文件路径,但是我试了一下,修改保存会提示没有权限

    我直接在项目运行create-umi,结果竟然成功了

    create-umi
    ? 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? TypeScript
    ? � Do you need all the blocks or a simple scaffold? simple
    ? � Time to use better, faster and latest antd@4! antd@4
    Cloning into 'D:genuineadmin'...
    remote: Enumerating objects: 199, done.
    remote: Counting objects: 100% (199/199), done.
    remote: Compressing objects: 100% (184/184), done.
    remote: Total 199 (delta 30), reused 72 (delta 9), pack-reused 0R Receiv
    Receiving objects: 100% (199/199), 300.08 KiB | 165.00 KiB/s, done.
    Resolving deltas: 100% (30/30), done.
    > � clone success
    > Clean up...
    ✨ File Generate Done

    然后思考了一下,真正创建项目的命令是create-umi  一开始的yarn create umi其实是全局安装这个命令,就和我们使用vue-cli需要安装vue create一样

    如果你也遇到这个问题,不妨试一下分两步运行命令1. yarn create umi  2.create-umi 注意create-umi中间是横线连着的

  • 相关阅读:
    Jersey初始化配置
    Jersey框架简介
    警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:esignmanage' did not find a matching property.解决
    HIbernate基于外键的查询
    Apache Maven 入门篇(下)
    Apache Maven 入门篇 ( 上 )
    DetachedCriteria用法
    SQL Excel导入到sqlserver表
    轮番图片js
    Js Tab页(二)
  • 原文地址:https://www.cnblogs.com/steamed-twisted-roll/p/14382329.html
Copyright © 2011-2022 走看看