question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deployment to Heroku or Google cloud fails

See original GitHub issue

Hi, I am new to Node.js and I am trying to learn and deploy this code. I was successfully able to deploy it locally on Windows 10 and Ubuntu and it worked fine (node v8.1.2, npm 5.0.3). After that, I tried deploying it on Heroku and also Google Could AppEngine and I got the error “Cannot find module ./dist/vue-ssr-server-bundle.json” with both. Details below:

Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
yarn start v0.27.5
$ cross-env NODE_ENV=production node server
module.js:487
    throw err;
    ^

Error: Cannot find module './dist/vue-ssr-server-bundle.json'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/server.js:41:18)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
error Command failed with exit code 1.

While trying to debug this issue, I changed the package.json (line 8) from: "start": "cross-env NODE_ENV=production node server", to: "start": "cross-env NODE_ENV=development node server",

and that also works fine locally. But on Heroku or Google cloud, I got the different error:

Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
yarn start v0.27.5
$ cross-env NODE_ENV=development node server
module.js:487
    throw err;
    ^

Error: Cannot find module 'glob'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/build/webpack.client.config.js:1:76)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
error Command failed with exit code 1.

Is this an issue with the code or am I missing something in my environment to deploy this to the cloud?

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
valentinvieriucommented, Jul 14, 2017

If you want to deploy on Heroku, you need to modify a little the app. The simplest way to do this is to remove the ignore the in the .gitignore of the dist folder, and then create the build locally on your machine. After doing that you commit your code and push it to heroku.

You might need to modify the start code too in your package.json "start": "NODE_ENV=production node server" or add a Procfile in the root of your folder with the code web: node --harmony-async-await --optimize_for_size --max_old_space_size=460 --gc_interval=100 server.js

0reactions
melliott03commented, Aug 18, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Did Heroku Fail? - Matt Rickard
Heroku's business model was incompatible with its product. They could not sell cloud primitives while being built on cloud.
Read more >
Troubleshoot Cloud Run issues
The following error occurs when you try to deploy or try to call another Google Cloud API: The server has encountered an internal...
Read more >
Google Cloud Run vs. Heroku - - The Iron.io Blog
We've picked two of the most popular: Heroku, one of the first Platform as a Service (PaaS) for developers, and the relatively new...
Read more >
Google Cloud vs Heroku Comparison 2022 - PeerSpot
We performed a comparison between Google Cloud and Heroku based on real PeerSpot user reviews ... pricing, service and support, easy of deployment,...
Read more >
How to deploy your API (Heroku or Google Cloud) - YouTube
In this 3rd and final installment of our hands-on coding workshop, Rachael Tatman is walking you through how to deploy your models so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found