ant-design / ant-design-pro

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

🧐[问题]执行两次npm install ,第二次npm install 会remove掉 node_modules的中包 #7942

Closed Saber-Kurama closed 3 years ago

Saber-Kurama commented 3 years ago

🧐 问题描述

采用 npm create umi 安装 Pro V5 第一次执行 npm install 之后 再次执行 npm install 会出现下面错误

➜  umi-pro1 npm i

> ant-design-pro@5.0.0-beta.2 postinstall /Users/saber/coding/shushiwork/umi-pro1
> umi g tmp

sh: umi: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn

环境 mac

➜  ~ node -v
v14.4.0
➜  ~ npm -v
6.14.4
➜  ~ 

💻 示例代码

➜  umi-pro1 npm create umi   
? Select the boilerplate type ant-design-pro
(node:12774) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12774) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:12774) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
? 🧙 Be the first to experience the new umi@3 ? Pro V5
Cloning into '/Users/saber/coding/shushiwork/umi-pro1'...
remote: Enumerating objects: 178, done.
remote: Counting objects: 100% (178/178), done.
remote: Compressing objects: 100% (164/164), done.
remote: Total 178 (delta 30), reused 60 (delta 9), pack-reused 0
Receiving objects: 100% (178/178), 292.39 KiB | 237.00 KiB/s, done.
Resolving deltas: 100% (30/30), done.
> 🚚 clone success
> Clean up...
✨ File Generate Done
➜  umi-pro1 code .

第一次执行 npm install 安装成功

➜  umi-pro1 npm i
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated cheerio-select-tmp@0.1.1: Use cheerio-select instead
npm WARN deprecated @hapi/joi@16.1.8: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated core-js@2.6.12: 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.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat
npm WARN deprecated @hapi/formula@1.2.0: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/pinpoint@1.0.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated @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.

> fsevents@1.2.13 install /Users/saber/coding/shushiwork/umi-pro1/node_modules/jest-environment-jsdom-fourteen/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.13 install /Users/saber/coding/shushiwork/umi-pro1/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> puppeteer-core@1.12.2 install /Users/saber/coding/shushiwork/umi-pro1/node_modules/carlo/node_modules/puppeteer-core
> node install.js

> ejs@2.7.4 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/@umijs/mem-fs-editor/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

> core-js@3.8.2 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/@umijs/test/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> core-js@2.6.12 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@3.6.5 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js-pure@3.8.2 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

> esbuild@0.8.31 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/esbuild
> node install.js

> ejs@2.7.4 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/umi-webpack-bundle-analyzer/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

> @umijs/yorkie@2.0.5 postinstall /Users/saber/coding/shushiwork/umi-pro1/node_modules/@umijs/yorkie
> node bin/install.js

setting up Git hooks
can't find .git directory, skipping Git hooks installation

> ant-design-pro@5.0.0-beta.2 postinstall /Users/saber/coding/shushiwork/umi-pro1
> umi g tmp

WARN [WARN] update `jsx: "react"` into `jsx: "react-jsx"` to suport the new JSX transform in React 17 in tsconfig.json
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @ant-design/pro-form@1.13.8 requires a peer of react@^16.x but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/pro-table@2.23.0 requires a peer of react@^16.x but none is installed. You must install peer dependencies yourself.
npm WARN use-media-antd-query@1.0.2 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.
npm WARN react-dev-inspector@1.1.4 requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-helmet-async@1.0.7 requires a peer of react@^16.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-helmet-async@1.0.7 requires a peer of react-dom@^16.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/pro-skeleton@1.0.0-beta.12 requires a peer of react@^16.x but none is installed. You must install peer dependencies yourself.
npm WARN use-json-comparison@1.0.5 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/pro-field@1.8.5 requires a peer of react@^16.x but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/pro-utils@1.10.3 requires a peer of react@^16.x but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/pro-provider@1.4.1 requires a peer of react@^16.x but none is installed. You must install peer dependencies yourself.
npm WARN use-media-antd-query@1.0.3 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.
npm WARN react-copy-to-clipboard@5.0.2 requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @umijs/runtime@3.3.4 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.
npm WARN use-subscription@1.4.1 requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN dumi-theme-default@1.0.0 requires a peer of react@^16.13.1 but none is installed. You must install peer dependencies yourself.
npm WARN dva-immer@0.5.1 requires a peer of dva@^2.5.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN dva@2.6.0-beta.22 requires a peer of react@^16.8.4 but none is installed. You must install peer dependencies yourself.
npm WARN dva@2.6.0-beta.22 requires a peer of react-dom@^16.8.4 but none is installed. You must install peer dependencies yourself.
npm WARN babel-plugin-dva-hmr@0.4.2 requires a peer of redbox-react@1.x but none is installed. You must install peer dependencies yourself.
npm WARN dva-loading@3.0.22 requires a peer of dva-core@^1.1.0 | ^1.5.0-0 | ^1.6.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN connected-react-router@6.5.2 requires a peer of react@^16.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-intl@3.12.1 requires a peer of react@^16.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ahooksjs/use-request@2.8.1 requires a peer of react@^16.8.6 but none is installed. You must install peer dependencies yourself.

added 3196 packages from 1436 contributors and audited 3216 packages in 126.496s

237 packages are looking for funding
  run `npm fund` for details

found 9 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

第二次执行 npm install 出现下面错误

➜  umi-pro1 npm i

> ant-design-pro@5.0.0-beta.2 postinstall /Users/saber/coding/shushiwork/umi-pro1
> umi g tmp

sh: umi: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn

🚑 其他信息

猜测是 umi g tmp 的命令的原因。 这是我创建的一个npm create umi创建的项目, 去掉了"postinstall": "umi g tmp", https://github.com/Saber-Kurama/umi-pro.git 执行多次 npm install 没有问题 如果执行了 npm install 之后执行 umi g tmp,再次执行npm install会出现

removed 2562 packages and audited 3216 packages in 29.508s
chenshuai2144 commented 3 years ago

这是 npm 默认的行为,用 yarn 就好了,或者你删除掉 package.lock