electrode icon indicating copy to clipboard operation
electrode copied to clipboard

Heroku (and Docker Hub) Deployment Fails from GET STARTED, builds and runs locally

Open jlehew opened this issue 8 years ago • 0 comments

Bug Report

My React project based on Electrode stopped building on Docker Hub several months ago and found a solution by making a change to the dockerfile to build the get started Electrode sample app at http://www.electrode.io/docs/get_started.html from a different base image

It builds and runs locally no problem, only when pushed to Docker Hub and Heroku does it fail. It fails on both Docker Hub and Heroku and the fix works on both build platforms.

Possible fix

After spending much time forcing npm to look in various locations for packages and changing install locations, and the "get started app" was still failing on Docker Hub and Heroku, I started thinking something bigger seemed to be the cause. Updated the dockerfile to pull in a more recent image to run the build on and it started passing builds...

In the dockerfile changed the FROM statement Original: FROM node:4.5 Fixed: FROM node

Removing the version number is the same as using "latest" and because this solved all of my build issues, there must be a recent breaking change with npm or node.

Issues with similar titles

https://github.com/electrode-io/electrode/issues/221 https://github.com/electrode-io/electrode/issues/308

My environment

  • *GitHub Project set to auto build on both Docker Hub and Heroku when code committed to master branch
  • Node version: v8.4.0 on my dev laptop (not sure what Docker Hub and Heroku are using)
  • npm version: v6.4.1 on my dev laptop (not sure what Docker Hub and Heroku are using)

Expected behavior

The "get started app" (and my project) should build to production without error

Current behavior

Received errors during build process

Steps to reproduce the behavior

Follow steps in get started http://www.electrode.io/docs/get_started.html AND DEPLOY to Heroku or Docker Hub. It builds and runs fine with clap dev locally

While debugging and attempting to fix, I encountered other errors in the build logs. Including to allow community to find this ticket

  • npm ERR! Could not install from "../../usr/local/lib/node_modules/electrode-archetype-react-app" as it does not contain a package.json file.

  • [91m/bin/sh: 1: /usr/src/app/node_modules/.bin/clap: not found

  • [91mnpm ERR! Linux 4.4.0-1060-aws npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"

Command line output

-----> Node.js app detected

-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_ENV=production
   NODE_MODULES_CACHE=true
   NODE_VERBOSE=false

-----> Installing binaries engines.node (package.json): unspecified engines.npm (package.json): unspecified (use default)

   Resolving node version 10.x...
   Downloading and installing node 10.13.0...
   Using default npm version: 6.4.1

-----> Building dependencies Installing node modules (package.json + package-lock) npm ERR! code ENOLOCAL npm ERR! Could not install from "../../usr/local/lib/node_modules/electrode-archetype-react-app" as it does not contain a package.json file.

   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/npmcache.ozHLT/_logs/2018-11-07T19_48_23_176Z-debug.log

-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys
   
   Some possible problems:
   
   - Node version not specified in package.json
     https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
   
   Love,
   Heroku

! Push rejected, failed to compile Node.js app. ! Push failed

jlehew avatar Nov 19 '18 19:11 jlehew