basir / node-react-ecommerce

Build ECommerce Website Like Amazon By React & Node & MongoDB
https://node-react-ecommerce-app.herokuapp.com/
1.67k stars 782 forks source link

Application can't be started from Heroku #35

Open newlife-nbd opened 4 years ago

newlife-nbd commented 4 years ago

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. (/app/dist/routes/userRoute.js:75:2) 2020-06-04T15:41:07.747890+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30) 2020-06-04T15:41:07.747891+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) 2020-06-04T15:41:07.747891+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32) 2020-06-04T15:41:07.747891+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12) 2020-06-04T15:41:07.747892+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:681:19) 2020-06-04T15:41:07.747892+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:16:16) 2020-06-04T15:41:07.747892+00:00 app[web.1]: at Object. (/app/dist/server.js:11:41) 2020-06-04T15:41:07.747893+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:774:30) 2020-06-04T15:41:07.747893+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) 2020-06-04T15:41:07.747894+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:641:32) 2020-06-04T15:41:07.747894+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12) 2020-06-04T15:41:07.747895+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:837:10) 2020-06-04T15:41:07.747895+00:00 app[web.1]: at internal/main/run_main_module.js:17:11 2020-06-04T15:41:07.810785+00:00 heroku[web.1]: Process exited with status 1 2020-06-04T15:41:07.856558+00:00 heroku[web.1]: State changed from starting to crashed

basir commented 4 years ago

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

newlife-nbd commented 4 years ago

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) notifications@github.com Sent: Thursday, June 11, 2020 6:49:55 AM To: basir/node-react-ecommerce node-react-ecommerce@noreply.github.com Cc: newlife-nbd pengpengw@hotmail.com; Author author@noreply.github.com 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.

basir commented 4 years ago

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 notifications@github.com 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) notifications@github.com Sent: Thursday, June 11, 2020 6:49:55 AM To: basir/node-react-ecommerce node-react-ecommerce@noreply.github.com Cc: newlife-nbd pengpengw@hotmail.com; Author <author@noreply.github.com

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 .