Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6188

Cannot install on alpine

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Field Level Encryption
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      I'm trying to install npm package mongodb-client-encryption on the latest node:alpine image, but failing. Is there a way to fix?

      Steps to reproduce:

      1. docker run --rm -it node:20.13.1-alpine /bin/sh
      1. apk add --no-cache make=4.4.1-r2 gcc=13.2.1_git20231014-r0 g++=13.2.1_git20231014-r0 python3=3.11.9-r0
      1. npm i -g mongodb-client-encryption

      Output:

       

      npm ERR! code 1
      npm ERR! path /usr/local/lib/node_modules/mongodb-client-encryption
      npm ERR! command failed
      npm ERR! command sh -c prebuild-install --runtime napi --tag-prefix node-v || node-gyp rebuild
      npm ERR! make: Entering directory '/usr/local/lib/node_modules/mongodb-client-encryption/build'
      npm ERR!   CXX(target) Release/obj.target/mongocrypt/addon/mongocrypt.o
      npm ERR! make: Leaving directory '/usr/local/lib/node_modules/mongodb-client-encryption/build'
      npm ERR! prebuild-install warn install No prebuilt binaries found (target=4 runtime=napi arch=arm64 libc=musl platform=linux)
      npm ERR! gyp info it worked if it ends with ok
      npm ERR! gyp info using node-gyp@10.1.0
      npm ERR! gyp info using node@20.13.1 | linux | arm64
      npm ERR! gyp info find Python using Python version 3.11.9 found at "/usr/bin/python3"
      npm ERR! gyp http GET https://nodejs.org/download/release/v20.13.1/node-v20.13.1-headers.tar.gz
      npm ERR! gyp http 200 https://nodejs.org/download/release/v20.13.1/node-v20.13.1-headers.tar.gz
      npm ERR! gyp http GET https://nodejs.org/download/release/v20.13.1/SHASUMS256.txt
      npm ERR! gyp http 200 https://nodejs.org/download/release/v20.13.1/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/local/lib/node_modules/mongodb-client-encryption/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/20.13.1/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/20.13.1',
      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/20.13.1/<(target_arch)/node.lib',
      npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/mongodb-client-encryption',
      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! In file included from ../addon/mongocrypt.cc:1:
      npm ERR! ../addon/mongocrypt.h:16:10: fatal error: mongocrypt/mongocrypt.h: No such file or directory
      npm ERR!    16 | #include <mongocrypt/mongocrypt.h>
      npm ERR!       |          ^~~~~~~~~~~~~~~~~~~~~~~~~
      npm ERR! compilation terminated.
      npm ERR! make: *** [mongocrypt.target.mk:106: Release/obj.target/mongocrypt/addon/mongocrypt.o] Error 1
      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.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
      npm ERR! gyp ERR! System Linux 6.6.26-linuxkit
      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/local/lib/node_modules/mongodb-client-encryption
      npm ERR! gyp ERR! node -v v20.13.1
      npm ERR! gyp ERR! node-gyp -v v10.1.0
      npm ERR! gyp ERR! not ok
      npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-05-16T14_21_39_582Z-debug-0.log
      

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            gady@ox.security Gady Piazza
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: