Skip to content

node16 issue using gitlab runner

Summary

We try to build docker image using node:16 as a base. While Dockerfile is building locally, it is not using gitlab runner (cloud). The error is:

npm ERR! code 1
npm ERR! path /usr/src/app/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! make: Entering directory '/usr/src/app/node_modules/deasync/build'
npm ERR! make: Leaving directory '/usr/src/app/node_modules/deasync/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.2.0
npm ERR! gyp info using node@16.13.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/bin/python3"
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.13.0/SHASUMS256.txt
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.13.0/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/src/app/node_modules/deasync/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.cache/node-gyp/16.13.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.13.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/src/app/node_modules/deasync',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: printf: Operation not permitted
npm ERR! make: *** [deasync.target.mk:111: Release/obj.target/deasync/src/deasync.o] Error 127
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.4.109+
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /usr/src/app/node_modules/deasync
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v8.2.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-11-10T11_37_11_125Z-debug.log

Steps to reproduce

Please check this pipeline https://gitlab.com/michalpiasecki/node-16-issue/-/pipelines/406336326

Example Project

https://gitlab.com/michalpiasecki/node-16-issue/-/tree/main

What is the current bug behavior?

Same commands that I run locally should work when using gitlab runner

What is the expected correct behavior?

Building of service - node16 - should finish without an error

Relevant logs and/or screenshots

docker build --no-cache --file node16/Dockerfile .
[+] Building 211.1s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                                                                     0.0s
 => => transferring dockerfile: 37B                                                                                      0.0s
 => [internal] load .dockerignore                                                                                        0.0s
 => => transferring context: 2B                                                                                          0.0s
 => [internal] load metadata for docker.io/library/node:16-alpine                                                        1.3s
 => [internal] load build context                                                                                        0.0s
 => => transferring context: 72B                                                                                         0.0s
 => [1/6] FROM docker.io/library/node:16-alpine@sha256:3bca55259ada636e5fee8f2836aba7fa01fed7afd0652e12773ad44af95868b9  0.0s
 => CACHED [2/6] WORKDIR /usr/src/app                                                                                    0.0s
 => [3/6] RUN apk add --no-cache bash python3 make g++                                                                   6.7s
 => [4/6] RUN npm install -g http-server                                                                                 7.6s
 => [5/6] COPY package*.json ./                                                                                          0.0s
 => [6/6] RUN npm install                                                                                              178.8s
 => exporting to image                                                                                                  16.5s
 => => exporting layers                                                                                                 16.5s
 => => writing image sha256:9966b59a96b90f91501abfd38df818e7cf3f69f9d6c4055c8ccc81d2115e3ce7                             0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

Docker version I am using locally is the same as in .gitlab-ci.yml

docker --version
Docker version 20.10.7, build f0df350

Output of checks

This bug happens on GitLab.com