Losing my mind with this build error. Please help!

I’ve been stuck on this for days, and I think I’ve tried everything…

My Env / Dockerfile:

FROM centos:6

# Update and install yum dependencies
RUN yum update -y
RUN yum groupinstall 'Development Tools' -y
RUN yum install -y tar
RUN yum clean all

# Originally from https://github.com/joyent/docker-node Dockerfile...
#
# verify gpg and sha256: http://nodejs.org/dist/v0.10.30/SHASUMS256.txt.asc
# gpg: aka "Timothy J Fontaine (Work) <tj.fontaine@joyent.com>"
# gpg: aka "Julien Gilli <jgilli@fastmail.fm>"
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7937DFD2AB06298B2293C3187D33FF9D0246406D 114F43EE0176B71C7BC219DD50A3051F888C628D

# Set environment variables
ENV NODE_ENV development
ENV NODE_VERSION 0.12.5
ENV NPM_VERSION 2.11.3

RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
    && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
    && gpg --verify SHASUMS256.txt.asc \
    && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
    && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
    && rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \
    && npm install -g npm@"$NPM_VERSION" \
    && npm cache clear

# Install npm modules
RUN npm install -g grunt-cli gulp pm2 node-gyp
...

When it gets to the business of running the node server js file, I get the following:

---
build errors (/src/node_modules/couchbase/lib/../builderror.log):
---
../src/couchbase_impl.cc:356:20: warning: unused variable 'me' [-Wunused-variable]
    CouchbaseImpl *me = (CouchbaseImpl *)lcb_get_cookie(instance);
                   ^
1 warning generated.

---
load exceptions:
---
`couchbase_impl`:
[Error: /src/node_modules/couchbase/build/Release/couchbase_impl.node: invalid ELF header]
---
/src/node_modules/couchbase/lib/binding.js:188
  throw new Error('Failed to locate couchnode native binding' +
        ^
Error: Failed to locate couchnode native binding (see above for more information!)
    at Object.<anonymous> (/src/node_modules/couchbase/lib/binding.js:188:9)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/src/node_modules/couchbase/lib/couchbase.js:3:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

In my package.json, I’ve even tried pointing to other builds of couchbase:

"dependencies": {
...
    "couchbase": "git+https://github.com/brett19/couchnode.git"
...
  },

Any ideas before I kill myself?

Hi,

please don’t kill yourself. We’ll figure something out, probably with the help of @brett19. It does look like a mismatch of versions.

Oh FFS! I figured out what was happening… My .dockerignore file was missing the node_modules entry, so after the Dockerfile’s npm install of the package.json deps including couchbase, the

ADD . /src

… was taking my laptop (MBP) built node_models and overriding the ones built against the centos image. So when I ran the image, everything works but couchbase, since it’s been built against a mac.