Couchbase Node.js SDK errors out with Dockerfile

When creating the Docker image of my application which has “Couchbase” in it’s package.json errors out with the following message:

    FROM node:10.13-alpine
    ENV NODE_ENV production
    ENV REDIS_URL redis://cache
    ENV PORT 3001
    WORKDIR /usr/src/app
    COPY package*.json ./
    RUN npm install --production
    COPY . /usr/src/app
    EXPOSE 3001
    CMD npm run prod

Compilation error:

Step 7/10 : RUN npm install --production
—> Running in e1c0804a023e
couchbase@2.6.10 install /usr/src/app/node_modules/couchbase
prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=10.13.0 runtime=node arch=x64 libc=musl platform=linux)
gyp ERR! configure error
gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable.


"dependencies": {
    "axios": "^0.19.2",
    "babel-loader": "^8.0.0-beta.0",
    "body-parser": "^1.19.0",
    "cookie-parser": "~1.4.4",
    "couchbase": "^2.6.10",
    "dateformat": "^3.0.3",
    "debug": "~2.6.9",
    "express": "~4.16.1",
    "http-errors": "~1.6.3",
    "jsonwebtoken": "^8.5.1",
    "morgan": "~1.9.1",
    "npm-run-all": "^4.1.5",
    "pug": "^2.0.4",
    "redis": "^2.8.0",
    "rimraf": "^3.0.2"
  "devDependencies": {
    "@babel/cli": "^7.8.3",
    "@babel/core": "^7.8.3",
    "@babel/node": "^7.8.3",
    "@babel/preset-env": "^7.8.3",
    "dotenv": "^8.2.0",
    "dotenv-flow": "^3.1.0",
    "nodemon": "^2.0.2"

I’m running my code on Windows 10 x64. The same code is working for me by some additional configurations made to my PC i.e. installing windows-build-tools and node-gyp, configuring node-gyp for python variable and msvs_version to 2017.

Please suggest your ideas so that I can create a docker image from my system and run it.
Thank you
Ankit Lalan

Hey @ankitlalan,

It looks like your Docker environment is not one which we have prebuilds available for, so node-gyp is attempting to build the native part of our library and failing due to missing build dependancies. You can see the required dependencies here:

Cheers, Brett

Thanks @brett19.
I’m using windows 10 and I’m able to install the SDK after multiple configurations updates, mentioned above.
I’m running into trouble when building my package.json using Dockerfile. Package.json contains Couchbase@2.6.10, thus when image is built it errors out.

Do I need to include node-gyp, python and windows-build-tools in my Dockerfile. But this doesn’t make sense as I’ll be running the image on a Centos server and on Centos server I cannot have Microsoft Visual Studio Build tools.

Hey @ankitlalan,

We only have a subset of our supported platforms pre-built with binaries for installation, and it appears that your configuration is not within that subset of platforms. Unfortunately this means you will need to install the build tools in order to build the binaries. Note that it is possible to prebuilt the binaries on one system and deploy this to many, though this is not entirely straightforward to achieve.

Cheers, Brett

Hey @brett19, thanks for your reply.
After brain-storming, I finally found the way to build my “Couchbase SDK” on a windows server using Dockerfile.

Update the following lines in the Dockerfile will run all the dependencies required for building Couchbase SDK.

1. RUN apk --no-cache add --virtual native-deps g++ gcc libgcc libstdc++ linux-headers make python && npm install --quiet node-gyp -g
2. RUN apk del native-deps

Paste the Line #1 before you have “npm install --production” and then Line #2. Once we have Line #1, it will install all the dependencies required for building Couchbase SDK, then “npm install” will install all the packages required including Couchbase and finally Line #2 will be helpful to remove the dependencies of host system.

That’s all.

Thank you
Ankit Lalan