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

🧐[问题]Jenkins构建一直报错error in ./src/.umi-production/core/routes.ts #9191

Closed xlszzck closed 2 years ago

xlszzck commented 2 years ago

🧐 问题描述

本地打包没问题 但是在Jenkins上构建就一直报错 不知道是不是dockerfile写得有问题 不知道该从哪儿下手

💻 Jenkins报错提示

+ npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
+ npm i --registry=https://registry.npm.taobao.org

> puppeteer-core@1.12.2 install /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/carlo/node_modules/puppeteer-core
> node install.js

> core-js@2.6.12 postinstall /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@3.6.5 postinstall /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js-pure@3.18.2 postinstall /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

> ejs@2.7.4 postinstall /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/ejs
> node ./postinstall.js

> esbuild@0.12.15 postinstall /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/esbuild
> node install.js

> esbuild@0.8.57 postinstall /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/esbuild-loader/node_modules/esbuild
> node install.js

npm WARN lifecycle ant-design-pro@5.0.0~postinstall: cannot run in wd ant-design-pro@5.0.0 umi g tmp (wd=/var/lib/jenkins/workspace/ant-design-pro-master)
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"})
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"})

added 2059 packages from 1130 contributors in 43.162s
+ yarn build
yarn run v1.22.15
$ umi build
Bundle with webpack 5...
[info] [webpackbar] Compiling Webpack
(node:10777) [DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS] DeprecationWarning: optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors
(node:10777) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
(node:10777) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
[success] [webpackbar] Webpack: Compiled with some errors in 1.02m
 ERROR  Failed to compile with 1 errors1:57:15 PM

 error  in ./src/.umi-production/core/routes.ts

Module not found: Error: Can't resolve '/var/lib/jenkins/workspace/ant-design-pro-master/src/pages/user/Login' in '/var/lib/jenkins/workspace/ant-design-pro-master/src/.umi-production/core'

ERROR in ./src/.umi-production/core/routes.ts 26:21-28:86
Module not found: Error: Can't resolve '/var/lib/jenkins/workspace/ant-design-pro-master/src/pages/user/Login' in '/var/lib/jenkins/workspace/ant-design-pro-master/src/.umi-production/core'
 @ ./src/.umi-production/umi.ts 9:0-42 25:33-42

webpack compiled with 1 error
null
build failed
Error: build failed
    at /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/@umijs/bundler-webpack/lib/index.js:172:29
    at /var/lib/jenkins/workspace/ant-design-pro-master/node_modules/@umijs/deps/compiled/webpack/5/bundle5.js:114591:14
    at processQueueWorker (/var/lib/jenkins/workspace/ant-design-pro-master/node_modules/@umijs/deps/compiled/webpack/5/bundle5.js:114529:6)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

💻 dockerfile 代码



WORKDIR /usr/src/app/
USER root

COPY ./ ./
RUN npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
RUN npm i --registry=https://registry.npm.taobao.org
RUN npm install -g umi
RUN yarn build

CMD ["npm", "start"]```
github-actions[bot] commented 2 years ago

以下的 Issues 可能会帮助到你 / The following issues may help you

chenshuai2144 commented 2 years ago

大小写问题哦