Application can't be started from Heroku
I always see userRoute errors as below. can you please help with me?
2020-06-04T15:41:02.053612+00:00 heroku[web.1]: State changed from crashed to starting
2020-06-04T15:41:04.401044+00:00 heroku[web.1]: Starting process with command node dist/server.js
2020-06-04T15:41:07.747864+00:00 app[web.1]: /app/dist/routes/userRoute.js:23
2020-06-04T15:41:07.747888+00:00 app[web.1]: var _ref = _asyncToGenerator( /#PURE/regeneratorRuntime.mark(function _callee(req, res) {
2020-06-04T15:41:07.747888+00:00 app[web.1]: ^
2020-06-04T15:41:07.747889+00:00 app[web.1]:
2020-06-04T15:41:07.747889+00:00 app[web.1]: ReferenceError: regeneratorRuntime is not defined
2020-06-04T15:41:07.747889+00:00 app[web.1]: at /app/dist/routes/userRoute.js:23:46
2020-06-04T15:41:07.747890+00:00 app[web.1]: at Object.
You need to follow these steps to resolve that issue:
Create git repository in amazona folder using git init
Create Heroku Account at heroku.com
Install Heroku CLI
$ heroku login
$ heroku apps:create amazonaapp
Edit package.json
“build”: “rm -rf dist && babel backend -d dist”,
“heroku-postbuild”: “npm run build && cd frontend && npm install && npm run build”
“engines”: { “node”: “12.4.0”, “npm”: “6.9.0”}
Create Procfile
web: node dist/server.js
Set MongoDB connection string in Heroku
Open Heroku apps https://dashboard.heroku.com/apps/
Select your apps, open Setting Tab and click Reveal Config Vars
Add key MONGODB_URL
Enter copied connection string from the previous step
Edit config.js
PORT: process.env.PORT || 5000
Edit server.js
app.use(express.static(path.join(__dirname, ‘/../frontend/build’)));
app.get(‘*’, (req, res) => res.sendFile(path.join(${__dirname}/../frontend/build/index.html));
app.listen(config.PORT, …)
Edit .babelrc
[“@babel/preset-env”,,{“targets”: {“node”: “current”}}]
git add . && git commit -m “publish”
git push heroku
I think that I followed. Why the front end was not built? It is empty folder in heroic.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Bassir Jafarzadeh (Coding Teacher) [email protected] Sent: Thursday, June 11, 2020 6:49:55 AM To: basir/node-react-ecommerce [email protected] Cc: newlife-nbd [email protected]; Author [email protected] Subject: Re: [basir/node-react-ecommerce] Application can't be started from Heroku (#35)
You need to follow these steps to resolve that issue: Create git repository in amazona folder using git init Create Heroku Account at heroku.com Install Heroku CLI $ heroku login $ heroku apps:create amazonaapp Edit package.json “build”: “rm -rf dist && babel backend -d dist”, “heroku-postbuild”: “npm run build && cd frontend && npm install && npm run build” “engines”: { “node”: “12.4.0”, “npm”: “6.9.0”} Create Procfile web: node dist/server.js Set MongoDB connection string in Heroku Open Heroku apps https://dashboard.heroku.com/apps/ Select your apps, open Setting Tab and click Reveal Config Vars Add key MONGODB_URL Enter copied connection string from the previous step Edit config.js PORT: process.env.PORT || 5000 Edit server.js app.use(express.static(path.join(__dirname, ‘/../frontend/build’))); app.get(‘*’, (req, res) => res.sendFile(path.join(${__dirname}/../frontend/build/index.html)); app.listen(config.PORT, …) Edit .babelrc [“@babel/preset-env”,,{“targets”: {“node”: “current”}}] git add . && git commit -m “publish” git push heroku
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/basir/node-react-ecommerce/issues/35#issuecomment-642566965, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APELIZIOJNGFHUFVMZOCFFLRWCZFHANCNFSM4NSX5XRA.
Let’s have Skype call to fix your issue. My Skype name is basir.jafarzadeh
On Thu, Jun 11, 2020 at 5:01 PM newlife-nbd [email protected] wrote:
I think that I followed. Why the front end was not built? It is empty folder in heroic.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Bassir Jafarzadeh (Coding Teacher) [email protected] Sent: Thursday, June 11, 2020 6:49:55 AM To: basir/node-react-ecommerce [email protected] Cc: newlife-nbd [email protected]; Author <[email protected]
Subject: Re: [basir/node-react-ecommerce] Application can't be started from Heroku (#35)
You need to follow these steps to resolve that issue: Create git repository in amazona folder using git init Create Heroku Account at heroku.com Install Heroku CLI $ heroku login $ heroku apps:create amazonaapp Edit package.json “build”: “rm -rf dist && babel backend -d dist”, “heroku-postbuild”: “npm run build && cd frontend && npm install && npm run build” “engines”: { “node”: “12.4.0”, “npm”: “6.9.0”} Create Procfile web: node dist/server.js Set MongoDB connection string in Heroku Open Heroku apps https://dashboard.heroku.com/apps/ Select your apps, open Setting Tab and click Reveal Config Vars Add key MONGODB_URL Enter copied connection string from the previous step Edit config.js PORT: process.env.PORT || 5000 Edit server.js app.use(express.static(path.join(__dirname, ‘/../frontend/build’))); app.get(‘*’, (req, res) => res.sendFile(path.join(${__dirname}/../frontend/build/index.html)); app.listen(config.PORT, …) Edit .babelrc [“@babel/preset-env”,,{“targets”: {“node”: “current”}}] git add . && git commit -m “publish” git push heroku
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/basir/node-react-ecommerce/issues/35#issuecomment-642566965>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/APELIZIOJNGFHUFVMZOCFFLRWCZFHANCNFSM4NSX5XRA
.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/basir/node-react-ecommerce/issues/35#issuecomment-642612828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATUFQ5LEJ7WLZOQDSG6CUTRWDFBVANCNFSM4NSX5XRA .