Closed whg517 closed 4 years ago
Meeting the same problem
The problem recurred when I was operating in a new system environment. Even though I used what I thought was the right thing to do
[root@iZ2zedpo29j86sp10axjroZ test]# yarn create umi
yarn create v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-umi@0.19.0" with binaries:
- create-umi
? Select the boilerplate type ant-design-pro
? Which language do you want to use? TypeScript
> git clone https://github.com/ant-design/ant-design-pro --depth=1 /tmp/test
events.js:298
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on AntDesignProGenerator instance at:
at Immediate.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:451:18)
at processImmediate (internal/timers.js:456:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn git',
path: 'git',
spawnargs: [
'clone',
'https://github.com/ant-design/ant-design-pro',
'--depth=1',
'/tmp/test'
],
stdout: '',
stderr: '',
failed: true,
signal: null,
cmd: 'git clone https://github.com/ant-design/ant-design-pro --depth=1 /tmp/test',
timedOut: false,
killed: false
}
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-umi
Arguments:
Directory: /tmp/test
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
[root@iZ2zedpo29j86sp10axjroZ test]# git ini^C
[root@iZ2zedpo29j86sp10axjroZ test]# yum install git
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 git.x86_64.0.1.8.3.1-20.el7 将被 安装
--> 正在处理依赖关系 perl-Git = 1.8.3.1-20.el7,它被软件包 git-1.8.3.1-20.el7.x86_64 需要
--> 正在处理依赖关系 perl(Term::ReadKey),它被软件包 git-1.8.3.1-20.el7.x86_64 需要
--> 正在处理依赖关系 perl(Git),它被软件包 git-1.8.3.1-20.el7.x86_64 需要
--> 正在处理依赖关系 perl(Error),它被软件包 git-1.8.3.1-20.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-Error.noarch.1.0.17020-2.el7 将被 安装
---> 软件包 perl-Git.noarch.0.1.8.3.1-20.el7 将被 安装
---> 软件包 perl-TermReadKey.x86_64.0.2.30-20.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=====================================================================================================================================================================================================================
Package 架构 版本 源 大小
=====================================================================================================================================================================================================================
正在安装:
git x86_64 1.8.3.1-20.el7 base 4.4 M
为依赖而安装:
perl-Error noarch 1:0.17020-2.el7 base 32 k
perl-Git noarch 1.8.3.1-20.el7 base 55 k
perl-TermReadKey x86_64 2.30-20.el7 base 31 k
事务概要
=====================================================================================================================================================================================================================
安装 1 软件包 (+3 依赖软件包)
总下载量:4.5 M
安装大小:22 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): perl-Error-0.17020-2.el7.noarch.rpm | 32 kB 00:00:00
(2/4): perl-Git-1.8.3.1-20.el7.noarch.rpm | 55 kB 00:00:00
(3/4): perl-TermReadKey-2.30-20.el7.x86_64.rpm | 31 kB 00:00:00
(4/4): git-1.8.3.1-20.el7.x86_64.rpm | 4.4 MB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 16 MB/s | 4.5 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 1:perl-Error-0.17020-2.el7.noarch 1/4
正在安装 : perl-TermReadKey-2.30-20.el7.x86_64 2/4
正在安装 : git-1.8.3.1-20.el7.x86_64 3/4
正在安装 : perl-Git-1.8.3.1-20.el7.noarch 4/4
验证中 : perl-Git-1.8.3.1-20.el7.noarch 1/4
验证中 : 1:perl-Error-0.17020-2.el7.noarch 2/4
验证中 : git-1.8.3.1-20.el7.x86_64 3/4
验证中 : perl-TermReadKey-2.30-20.el7.x86_64 4/4
已安装:
git.x86_64 0:1.8.3.1-20.el7
作为依赖被安装:
perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-20.el7 perl-TermReadKey.x86_64 0:2.30-20.el7
完毕!
[root@iZ2zedpo29j86sp10axjroZ test]# yarn create umi
yarn create v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-umi@0.19.0" with binaries:
- create-umi
? Select the boilerplate type ant-design-pro
? Which language do you want to use? TypeScript
> git clone https://github.com/ant-design/ant-design-pro --depth=1 /tmp/test
> Clean up...
✨ File Generate Done
Done in 51.06s.
[root@iZ2zedpo29j86sp10axjroZ test]# git init
初始化空的 Git 版本库于 /tmp/test/.git/
[root@iZ2zedpo29j86sp10axjroZ test]# yarn install
yarn install v1.21.1
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @ant-design/pro-layout > omit.js > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning @ant-design/pro-layout > antd > rc-tree-select > rc-trigger > rc-animate > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning umi > umi-build-dev > core-js@2.6.9: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning umi > umi-build-dev > decamelize > xregexp > @babel/runtime-corejs2 > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning umi > umi-build-dev > umi-notify > is-ali-env > superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header). This notice will go away with v5.0.2+ once it is released.
warning umi > umi-build-dev > umi-test > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning umi > umi-build-dev > umi-uni18n > @umijs/fabric > stylelint > postcss-markdown > remark > unified > @types/vfile > @types/vfile-message@2.0.0: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
warning umi-plugin-react > umi-plugin-polyfills > core-js@2.6.0: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning umi-plugin-react > workbox-webpack-plugin > workbox-build > joi@11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning umi-plugin-react > umi-plugin-locale > react-intl > intl-relativeformat@2.2.0: This package has been deprecated, please see migration guide at 'https://github.com/formatjs/formatjs/tree/master/packages/intl-relativeformat#migration-guide'
warning umi-plugin-react > workbox-webpack-plugin > workbox-build > joi > topo@2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning umi-plugin-react > workbox-webpack-plugin > workbox-build > joi > hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning umi-plugin-react > workbox-webpack-plugin > workbox-build > joi > topo > hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning jest-puppeteer > jest-environment-puppeteer > jest-dev-server > wait-on > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning umi-types > @types/xterm@3.0.0: This is a stub types definition for xterm.js (https://github.com/sourcelair/xterm.js/). xterm.js provides its own type definitions, so you don't need @types/xterm installed!
warning umi-types > @types/webpack-chain@5.2.0: This is a stub types definition. webpack-chain provides its own type definitions, so you do not need this installed.
warning umi-types > @types/moment@2.13.0: This is a stub types definition for Moment (https://github.com/moment/moment). Moment provides its own type definitions, so you don't need @types/moment installed!
[3/5] Fetching packages...
warning file-loader@2.0.0: Invalid bin field for "file-loader".
warning umi-url-pnp-loader@1.1.2: Invalid bin field for "umi-url-pnp-loader".
warning sha.js@2.4.11: Invalid bin entry for "sha.js" (in "sha.js").
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "dva > connected-react-router@6.5.2" has unmet peer dependency "react-router@^4.3.1 || ^5.0.0".
warning "umi > umi-build-dev > af-webpack > eslint-config-umi@1.6.0" has incorrect peer dependency "eslint-plugin-react-hooks@1.5.0".
warning "@umijs/fabric > eslint-plugin-react@7.13.0" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "umi > umi-build-dev > af-webpack > eslint-config-umi > eslint-config-react-app@5.0.2" has unmet peer dependency "@typescript-eslint/eslint-plugin@2.x".
warning "umi > umi-build-dev > af-webpack > eslint-config-umi > eslint-config-react-app@5.0.2" has unmet peer dependency "@typescript-eslint/parser@2.x".
warning "umi > umi-build-dev > af-webpack > eslint-config-umi > eslint-config-react-app@5.0.2" has incorrect peer dependency "eslint@6.x".
warning "umi > umi-build-dev > af-webpack > eslint-config-umi > eslint-config-react-app@5.0.2" has incorrect peer dependency "eslint-plugin-flowtype@3.x".
warning "@umijs/fabric > eslint-config-airbnb-base@13.2.0" has incorrect peer dependency "eslint@^4.19.1 || ^5.3.0".
warning "@umijs/fabric > eslint-config-airbnb@17.1.1" has incorrect peer dependency "eslint@^4.19.1 || ^5.3.0".
warning "@umijs/fabric > eslint-config-airbnb@17.1.1" has incorrect peer dependency "eslint-plugin-react@^7.14.2".
warning "@umijs/fabric > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "@typescript-eslint/parser@^1.9.0".
warning "@umijs/fabric > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@umijs/fabric > eslint-config-egg > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning "umi-plugin-react > umi-plugin-dva > babel-plugin-dva-hmr@0.4.2" has unmet peer dependency "redbox-react@1.x".
warning "umi-plugin-react > umi-plugin-dva > dva-loading@3.0.6" has unmet peer dependency "dva-core@^1.1.0 | ^1.5.0-0 | ^1.6.0-0".
warning " > jsdom-global@3.0.2" has unmet peer dependency "jsdom@>=10.0.0".
[5/5] Building fresh packages...
[9/11] ⢀ preact
[10/11] ⢀ husky
[8/11] ⢀ node-pty
[6/11] ⢀ styled-components
error /tmp/test/node_modules/husky: Command failed.
Exit code: 1
Command: node husky install
Arguments:
Directory: /tmp/test/node_modules/husky
Output:
[root@iZ2zedpo29j86sp10axjroZ test]#
Meeting the same problem
I find that if I delete husky
from devDependencies, everything works fine。
It has been reverted in v4.0.6.
It has been reverted in v4.0.6.
But and.desgin is using v4.0.0 in the main branch https://github.com/ant-design/ant-design-pro/blob/0a41c6ea55164054f9561c05465076687397bb8b/package.json#L100
🧐 husky: Command failed.
I'll start by outlining the problem, and then the actual operation and the output
Problem description:
Create a new directory, execute
yarn create umi
in the directory, install the dependencyyarn install
, and report an error. But at this point, you can execute the 'yarn start' project. If you executeyarn run fetch:blocks
, an error is reported on the third block insert and you cannot proceed. Look at the recurrence in detail.It was found that
husky
is related to git commit through search, I checked #5080 and guessed that my directory was not a git repository. After executinggit init
, it was normal to rerunyarn install
. However, I want to talk about one problem here.yarn create umi
is usually followed byyarn install
. Now,git init
is needed in the middle. It feels strange if you can directlygit init
without being able toyarn create umi
.Although using git to manage projects is a common understanding for most people, it is not ruled out that some projects are not initialized with git init, or some beginners do not use git. However, there is no specific or guiding prompt for such a question, so it is hard to avoid making people a little crazy when looking for the question. For example, I am not very familiar with what
husky
is used for, but I also do a temporary demo, and the previous project did not appear this problem, so I delayed a little time.It is recommended to add some hints to this problem, whether in the documentation or to catch exceptions. Make use more comfortable. thank you
Here's the problem recurring, so I'm not following the normal template:
中文
最开始我先简述一下问题,后面是实际操作和输出。 问题出现: 新建目录,在目录中执行 `yarn create umi`后安装依赖 `yarn install`,然后报错。但是这时候是可以执行 `yarn start` 运行项目的。如果执行 `yarn run fetch:blocks`, 会在 insert 第三个 block 的时候报错而且无法继续进行。详细看后面复现。 通过查找发现 `husky` 和 git commit 有关,查看了 #5080 猜测我的目录不是一个 git 仓库,执行了 `git init` 后重新运行 `yarn install` 正常了。不过这里我想说一个问题, `yarn create umi` 后一般就直接 `yarn install`,现在要在中间 `git init` 一下。如果直接先 `git init ` 又无法 `yarn create umi` ,感觉怪怪的。 虽然使用 git 管理项目是大部分人的一个共识,但不排除一些在初始化项目的时候还没来得及 git init ,或者一些新手并没有用 git。而报出这种问题没有具体或者带有引导性的提示信息,在查找问题的时候难免会让人有点抓狂。就比如我不是一个很熟悉 `husky` 这个是干嘛用的人,又临时做一个demo,而且以前的项目没有出现过这个问题,就耽误了一点时间。 建议对这个问题增加一些提示,无论是文档中,或者捕获异常都行。让使用更舒畅。谢谢。 下面是问题复现,我就不按正常模板写了:error
fine