Npm install fails on a native module

I have this tiny configuration

version: 2
jobs:
  build:
    docker:
      - image: maloubobola/gcloud-node:latest
    steps:
      - checkout
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: install-npm
          command: npm install --production
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - ./node_modules

but all my builds are failing during npm install --production. This docker image maloubobola/gcloud-node:latest is working locally and used to work well in gitlab CI. I’m just migrating to circleci.

Here is the error. Does someone has some idea to fix that ?

grpc@1.8.0 install /root/project/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.8.0/node-v57-linux-x64-glibc.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.8.0 and node@8.9.3 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.4.0-103-generic
gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “build” “–fallback-to-build” “–library=static_library” “–module=/root/project/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node” “–module_name=grpc_node” “–module_path=/root/project/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc”
gyp ERR! cwd /root/project/node_modules/grpc
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute ‘/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/root/project/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/root/project/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc’ (1)
node-pre-gyp ERR! stack at ChildProcess. (/root/project/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.4.0-103-generic
node-pre-gyp ERR! command “/usr/bin/node” “/root/project/node_modules/grpc/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build” “–library=static_library”
node-pre-gyp ERR! cwd /root/project/node_modules/grpc
node-pre-gyp ERR! node -v v8.9.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute ‘/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/root/project/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/root/project/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc’ (1)
npm WARN lambda-http-create-club@0.0.1 No description
npm WARN lambda-http-create-club@0.0.1 No repository field.
npm WARN lambda-http-create-club@0.0.1 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.8.0 install: node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.8.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-12-27T22_52_22_512Z-debug.log
Exited with code 1

What is this image? It looks like you missing some utilities like make

gyp ERR! stack Error: not found: make

You should be able to install it with sudo apt-get install make

The image has build-essential, which is supposed to has make included. Also everything is working well on my computer with the same image.

I fixed the problem with a new image https://hub.docker.com/r/maloubobola/circleci-gcloud-node/