umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.39k stars 2.65k forks source link

[Bug] umi3x构建的项目,在部署到 heroku时无法成功 #6573

Closed wbsndbf closed 3 years ago

wbsndbf commented 3 years ago

以下是 push 时候的异常: remote: > undefined postinstall /tmp/build_8dac1163 remote: > umi generate tmp

下面附上控制台全部输出: $ git push heroku master Enumerating objects: 8, done. Counting objects: 100% (8/8), done. Delta compression using up to 4 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 581 bytes | 581.00 KiB/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Using buildpack: heroku/nodejs remote: -----> Node.js app detected remote: remote: -----> Creating runtime environment remote: remote: NPM_CONFIG_LOGLEVEL=error remote: NODE_VERBOSE=false remote: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: remote: -----> Installing binaries remote: engines.node (package.json): unspecified remote: engines.npm (package.json): unspecified (use default) remote: remote: Resolving node version 14.x... remote: Downloading and installing node 14.17.0... remote: Using default npm version: 6.14.13 remote: remote: -----> Restoring cache remote: - node_modules remote: remote: -----> Installing dependencies remote: Installing node modules (package.json) remote: remote: > undefined postinstall /tmp/build_e5fa9a85 remote: > umi generate tmp remote: remote: audited 1410 packages in 12.402s remote: remote: 79 packages are looking for funding remote: run npm fund for details remote: remote: found 81 vulnerabilities (3 low, 76 moderate, 2 high) remote: run npm audit fix to fix them, or npm audit for details remote: remote: -----> Build remote: Detected both "build" and "heroku-postbuild" scripts remote: Running heroku-postbuild remote: remote: > @ heroku-postbuild /tmp/build_e5fa9a85 remote: > npm install && npm run build remote: remote: remote: > undefined postinstall /tmp/build_e5fa9a85 remote: > umi generate tmp remote: remote: audited 1410 packages in 12.981s remote: remote: 79 packages are looking for funding remote: run npm fund for details remote: remote: found 81 vulnerabilities (3 low, 76 moderate, 2 high) remote: run npm audit fix to fix them, or npm audit for details remote: remote: > @ build /tmp/build_e5fa9a85 remote: > umi build remote: remote: ℹ Compiling Webpack remote: ✔ Webpack: Compiled with some errors in 1.02m remote: ERROR Failed to compile with 1 errors6:22:22 AM remote: remote: This dependency was not found: remote: remote: * /tmp/build_e5fa9a85/src/pages/Report/write in ./src/.umi-production/core/routes.ts remote: remote: To install it, you can run: npm install --save /tmp/build_e5fa9a85/src/pages/Report/write remote: Child remote: remote: ERROR in ./src/.umi-production/core/routes.ts remote: null remote: Module not found: Error: Can't resolve '/tmp/build_e5fa9a85/src/pages/Report/write' in '/tmp/build_e5fa9a85/src/.umi-production/core' remote: @ ./src/.umi-production/core/routes.ts 32:19-72 37:19-72 remote: build failed remote: @ ./src/.umi-production/umi.ts remote: @ multi ./src/.umi-production/umi.ts remote: Error: build failed remote: at /tmp/build_e5fa9a85/node_modules/@umijs/bundler-webpack/lib/index.js:151:27 remote: at finalCallback (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108196:12) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108219:6 remote: at done (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:67212:13) remote: at runCompilers (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108123:48) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108130:7 remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:108212:7 remote: at finalCallback (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98589:39) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98605:13 remote: at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147581:10), :42:1) remote: at AsyncSeriesHook.lazyCompileHook (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147518:20) remote: at onCompiled (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:98603:21) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:99013:15 remote: at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147581:10), :6:1) remote: at AsyncSeriesHook.lazyCompileHook (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147518:20) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:99010:31 remote: at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147581:10), :9:1) remote: at AsyncSeriesHook.lazyCompileHook (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147518:20) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:97420:35 remote: at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147581:10), :9:1) remote: at AsyncSeriesHook.lazyCompileHook (/tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:147518:20) remote: at /tmp/build_e5fa9a85/node_modules/@umijs/deps/compiled/webpack/4/bundle4.js:97411:32 remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno 1 remote: npm ERR! @ build: umi build remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the @ build script. remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. remote: remote: npm ERR! A complete log of this run can be found in: remote: npm ERR! /tmp/npmcache.3MSZm/_logs/2021-05-14T06_22_22_862Z-debug.log remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno 1 remote: npm ERR! @ heroku-postbuild: npm install && npm run build remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the @ heroku-postbuild script. remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. remote: remote: npm ERR! A complete log of this run can be found in: remote: npm ERR! /tmp/npmcache.3MSZm/_logs/2021-05-14T06_22_22_884Z-debug.log remote: remote: -----> Build failed remote: remote: We're sorry this build is failing! You can troubleshoot common issues here: remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys remote: remote: Some possible problems: remote: remote: - Node version not specified in package.json remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version remote: remote: Love, remote: Heroku remote: remote: ! Push rejected, failed to compile Node.js app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: aed631e8d25522b2489bcf176912d68f588f1102 remote: ! remote: ! We have detected that you have triggered a build from source code with version aed631e8d25522b2489bcf176912d68f588f1102 remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku :main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to lizi-umicrm. remote: To https://git.heroku.com/lizi-umicrm.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/lizi-umicrm.git'

再附上我的package.json: { "private": true, "scripts": { "start": "umi dev", "build": "umi build", "postinstall": "umi generate tmp", "prettier": "prettier --write '*/.{js,jsx,tsx,ts,less,md,json}'", "test": "umi-test", "test:coverage": "umi-test --coverage", "heroku-postbuild": "npm install && npm run build" }, "gitHooks": { "pre-commit": "lint-staged" }, "lint-staged": { ".{js,jsx,less,md,json}": [ "prettier --write" ], ".ts?(x)": [ "prettier --parser=typescript --write" ] }, "dependencies": { "@ant-design/icons": "^4.6.2", "@ant-design/pro-layout": "^6.5.0", "@umijs/plugin-sass": "^1.1.1", "@umijs/preset-react": "1.x", "axios": "^0.21.1", "echarts": "^5.1.0", "echarts-for-react": "^3.0.1", "jwt-decode": "^3.1.2", "node-sass": "4.14.1", "sass-loader": "7.3.1", "umi": "^3.4.11", "wangeditor": "^4.6.17" }, "devDependencies": { "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "@umijs/test": "^3.4.11", "lint-staged": "^10.0.7", "prettier": "^2.2.0", "react": "17.x", "react-dom": "17.x", "typescript": "^4.1.2", "yorkie": "^2.0.0" } }

wbsndbf commented 3 years ago

我尝试了一下,同样无法部署到 netlify!

xiaohuoni commented 3 years ago

看下是不是大小写问题?src/pages/Report/write 这里?

wbsndbf commented 3 years ago

看下是不是大小写问题?src/pages/Report/write 这里? 感谢,我试试。