Deployment to Heroku or Google cloud fails
See original GitHub issueHi, 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:
- Created 6 years ago
- Comments:6
Top GitHub Comments
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 aProcfile
in the root of your folder with the codeweb: node --harmony-async-await --optimize_for_size --max_old_space_size=460 --gc_interval=100 server.js
@valentinvieriu thanks!