在Heroku上构建Parcel React应用失败



我正在尝试部署一个包裹反应应用程序,没有后台在Heroku。构建总是失败,我在互联网上尝试了所有方法。这是脚本& &;依赖关系。这里是错误。

错误:

lscpu: failed to determine number of CPUs: /sys/devices/system/cpu/possible: No such file or directory
/tmp/build_c7ac30db/src/components/App.js:14:19: Cannot resolve dependency '../pages/a00auth/A01SignUp.js' at '/tmp/build_c7ac30db/src/pages/a00auth/A01SignUp.js'
12 |
13 | import errorReporting from '../exceptions/errorReporting';
> 14 | import SignUp from '../pages/a00auth/A01SignUp.js';
|                   ^
15 | import SignIn from '../pages/a00auth/A02SignIn';
16 | import OfflineMessage from '../components/OfflineMessage';
17 |
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! teziagents@1.0.0 heroku-postbuild: `parcel build ./src/index.html`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the teziagents@1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.05UZK/_logs/2021-09-23T09_57_29_536Z-debug.log
-----> Build failed

脚本:

"scripts": {
"start": "parcel ./src/index.html",
"build": "parcel build ./src/index.html",
"postbuild": "workbox generateSW",
"predeploy": "rm -rf dist && npm run build",
"deploy": "gh-pages -d dist"
},

依赖性:

"dependencies": {
"@reach/router": "^1.3.4",
"grommet": "^2.17.1",
"grommet-controls": "^3.0.1",
"grommet-icons": "^4.5.0",
"parcel-bundler": "^1.12.5",
"@parcel/transformer-webmanifest": "^2.0.0-beta.2",
"pouchdb": "^7.2.2",
"pouchdb-authentication": "^1.1.3",
"pouchdb-browser": "^7.2.2",
"pouchdb-core": "^7.2.2",
"pouchdb-find": "^7.2.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hook-form": "^7.7.1",
"styled-components": "^5.2.3",
"tslib": "^2.2.0"
},
这里的任何帮助都是非常感激的。一个月来我一直在为这件事伤脑筋😔

Heroku是为后端应用程序设计的。无法构建您的应用程序。

所以,如果你想开发你的react应用程序,就必须使用nodejs包装器(构建的应用程序),这更复杂,但也不能像它能的那样快。

在这种情况下,如果你想部署一个几乎不需要配置的快速反应应用,你可以使用:

  • https://vercel.com/-就像访问你的repo一样简单,指定命令和文件夹;图片中的配置https://pasteboard.co/LKodGrRHO00X.png
  • https://www.netlify.com/-就像访问你的repo一样简单,指定命令和文件夹;图片中的配置https://pasteboard.co/WXecBxxJwylC.png
  • https://pages.github.com/

或者如果你可以在你的终端只上传dist文件夹,你也可以使用:

  • https://firebase.google.com/products/hosting