Здравствуйте, я хочу развернуть производственную сборку create-реагировать на приложение на сервере Heroku.
Сейчас я перепробовал все, но не смог найти способ развернуть его без использования serve npm или express server.
Я немного новичок в этом, поэтому, пожалуйста, предложите, если Express Server или Npm Server является обязательным для развертывания.
Сейчас я пытаюсь развернуть следующим образом: -
Hi have put npm run build command and get build folder now ,
In > .gitignor
file .
**I have added src/*
public/*
and removed /build.**
when i tried the process suggested by heroku.
git init
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"
git push heroku master
**
Error :-
Could not find a required file.
remote: Name: index.html
remote: Searched in: /tmp/build_bbe41ccff2d828824411f3a41b5ae0ae/public
I received following error :-
Counting objects: 23, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (23/23), 488.34 KiB | 0 bytes/s, done.
Total 23 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.15.3...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote: added 1767 packages from 770 contributors and audited 32007 packages in 36.788s
remote: found 96 vulnerabilities (71 low, 8 moderate, 17 high)
remote: run `npm audit fix` to fix them, or `npm audit` for details
remote:
remote: -----> Build
remote: Running build
remote:
remote: > client@0.1.0 build /tmp/build_bbe41ccff2d828824411f3a41b5ae0ae
remote: > react-scripts build
remote:
remote: Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
remote: Could not find a required file.
remote: Name: index.html
remote: Searched in: /tmp/build_bbe41ccff2d828824411f3a41b5ae0ae/public
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! client@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
I have also gone through various tutorials and all about use server.js in your react app to server build file.
Now I want to actually know that if i am doing right process or we could not deploy react production build on heroku.
You also can suggest better way to deploy it to heroku.