umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.59k stars 1.18k forks source link

bug: Error: Cannot find module 'umi' #665

Closed xzblog closed 3 years ago

xzblog commented 3 years ago

Versions

Steps to reproduce

我在服务端构建的时候偶尔会出现umi找不到的情况,

这是我的构建命令

npm i && npm run build

What is Expected?

以下是错误信息

npm i && npm run build
removed 2093 packages in 19.279s

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

> ant-design-pro@5.0.0-beta.2 build /home/jpom/server/data/build/ef439cc925dd427eace10ef147d0c491/source
> umi build

npm WARN lifecycle ant-design-pro@5.0.0-beta.2~postinstall: cannot run in wd ant-design-pro@5.0.0-beta.2 umi g tmp (wd=/home/jpom/server/data/build/ef439cc925dd427eace10ef147d0c491/source)
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 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 connected-react-router@6.5.2 requires a peer of react-redux@^6.0.0 || ^7.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN dumi-theme-default@1.0.16 requires a peer of react@^16.13.1 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 dva-core@2.0.4 requires a peer of redux@4.x but none is installed. You must install peer dependencies yourself.
npm WARN dva-immer@0.5.2 requires a peer of dva@^2.5.0-0 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 esbuild-loader@2.9.2 requires a peer of webpack@^4.40.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-debounce-input@3.2.3 requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-dev-inspector@1.5.3 requires a peer of webpack@>=4.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-inspector@2.3.1 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 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 react-motion@0.5.2 requires a peer of react@^0.14.9 || ^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-redux@4.4.10 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^15.4.0-0 || ^16.0.0-0 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 use-media-antd-query@1.0.6 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-environment-jsdom-fourteen/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Cannot find module 'umi'
Require stack:
- /home/jpom/server/data/build/ef439cc925dd427eace10ef147d0c491/source/config/config.ts
- /usr/local/share/.config/yarn/global/node_modules/@umijs/core/lib/Config/Config.js
- /usr/local/share/.config/yarn/global/node_modules/@umijs/core/lib/index.js
- /usr/local/share/.config/yarn/global/node_modules/umi/lib/ServiceWithBuiltIn.js
- /usr/local/share/.config/yarn/global/node_modules/umi/lib/cli.js
- /usr/local/share/.config/yarn/global/node_modules/umi/bin/umi.js
Error: Cannot find module 'umi'
Require stack:
- /home/jpom/server/data/build/ef439cc925dd427eace10ef147d0c491/source/config/config.ts
- /usr/local/share/.config/yarn/global/node_modules/@umijs/core/lib/Config/Config.js
- /usr/local/share/.config/yarn/global/node_modules/@umijs/core/lib/index.js
- /usr/local/share/.config/yarn/global/node_modules/umi/lib/ServiceWithBuiltIn.js
- /usr/local/share/.config/yarn/global/node_modules/umi/lib/cli.js
- /usr/local/share/.config/yarn/global/node_modules/umi/bin/umi.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.mod._resolveFilename (/usr/local/share/.config/yarn/global/node_modules/@umijs/bundler-webpack/lib/requireHook.js:49:28)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (/usr/local/share/.config/yarn/global/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/jpom/server/data/build/ef439cc925dd427eace10ef147d0c491/source/config/config.ts:2:1)
    at Module._compile (/usr/local/share/.config/yarn/global/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._compile (/usr/local/share/.config/yarn/global/node_modules/@umijs/deps/compiled/babel/bundle.js:140881:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.newLoader [as .ts] (/usr/local/share/.config/yarn/global/node_modules/@umijs/deps/compiled/babel/bundle.js:140886:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ant-design-pro@5.0.0-beta.2 build: `umi build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ant-design-pro@5.0.0-beta.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

What is actually happening?

这个错不是每次都会触发,偶尔发生, 还没找到规律,看日志貌似是npm包还没安装完成就开始执行npm run build命令导致的

谁能告诉我这是怎么回事吗?

PeachScript commented 3 years ago

Ant Design Pro 脚手架是基于 umi 而非 dumi,需要提供稳定复现、并提交 issue 到 umi 项目,issue 关闭