Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest Node:22 image package install compile error #2201

Open
exptom opened this issue Feb 14, 2025 · 6 comments
Open

Latest Node:22 image package install compile error #2201

exptom opened this issue Feb 14, 2025 · 6 comments

Comments

@exptom
Copy link

exptom commented Feb 14, 2025

Environment

  • Platform: x86
  • Docker Version: unknown - running on bitbucket pipelines
  • Node.js Version: 22
  • Image Tag: node:22

Expected Behavior

Installing mongodb-client-encryption package should work.

Current Behavior

Since the most recent update to the node:22 tag the install fails with the following compile problem:

mongodb-client-encryption@npm:6.1.1 STDERR prebuild-install warn This package does not support N-API version undefined
mongodb-client-encryption@npm:6.1.1 STDERR prebuild-install warn install No prebuilt binaries found (target=undefined runtime=napi arch=x64 libc= platform=linux)
...
mongodb-client-encryption@npm:6.1.1 STDERR In file included from ../addon/mongocrypt.cc:1:
mongodb-client-encryption@npm:6.1.1 STDERR ../addon/mongocrypt.h:17:10: fatal error: mongocrypt/mongocrypt.h: No such file or directory
mongodb-client-encryption@npm:6.1.1 STDERR    17 | #include <mongocrypt/mongocrypt.h>
mongodb-client-encryption@npm:6.1.1 STDERR       |          ^~~~~~~~~~~~~~~~~~~~~~~~~
mongodb-client-encryption@npm:6.1.1 STDERR compilation terminated.

Possible Solution

Forcing the build pipeline to use the previous node:22 image (using: node@sha256:5145c882f9e32f07dd7593962045d97f221d57a1b609f5bf7a807eb89deff9d6) allows the build to run without error.

@LaurentGoderre
Copy link
Member

Often libraries will have precompiled binaries but if those binaries are not found then they are compiled at install time. You need to explicitly install the dependencies needed to compile, libmongocrypt in this case.

@exptom
Copy link
Author

exptom commented Feb 14, 2025

We've been using the node:XX tags, node:18 and now node:22 for years to install that package. Since the new node:22 docker image published in the last 24 hours it has suddenly stopped working with those compile errors.

I think it might be the N-API version undefined error causing it to not use the prebuilt binaries.

@exptom
Copy link
Author

exptom commented Feb 14, 2025

It appears yesterday's docker image update bumped node 22 from 22.13.1 -> 22.14.0 so I guess the issue is actually with 22.14

@spencercorwin
Copy link

spencercorwin commented Feb 14, 2025

My build is also failing now on yarn install with the update from 22.13.1 -> 22.14.0. I'm using node:22-bookworm-slim. The image from a few days ago before the update works (node@sha256:83fdfa2a4de32d7f8d79829ea259bd6a4821f8b2d123204ac467fbe3966450fc). Apparently no longer a Python installation in node:22-bookworm-slim?

 > [builder 51/55] RUN yarn install:                                                                                                                                              
0.692 yarn install v1.22.22                                                                                                                                                       
0.939 [1/5] Validating package.json...                                                                                                                                            
0.980 [2/5] Resolving packages...                                                                                                                                                 
2.143 [3/5] Fetching packages...                                                                                                                                                  
90.68 info There appears to be trouble with your network connection. Retrying...
176.8 [4/5] Linking dependencies...
234.3 [5/5] Building fresh packages...
237.3 error /tmp/seedplanner/node_modules/sqlite3: Command failed.
237.3 Exit code: 1
237.3 Command: prebuild-install -r napi || node-gyp rebuild
237.3 Arguments: 
237.3 Directory: /tmp/seedplanner/node_modules/sqlite3
237.3 Output:
237.3 prebuild-install warn This package does not support N-API version undefined
237.3 prebuild-install warn install No prebuilt binaries found (target=undefined runtime=napi arch=x64 libc= platform=linux)
237.3 gyp info it worked if it ends with ok
237.3 gyp info using [email protected]
237.3 gyp info using [email protected] | linux | x64
237.3 (node:100) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
237.3 (Use `node --trace-deprecation ...` to show where the warning was created)
237.3 gyp ERR! find Python 
237.3 gyp ERR! find Python Python is not set from command line or npm configuration
237.3 gyp ERR! find Python Python is not set from environment variable PYTHON
237.3 gyp ERR! find Python checking if "python3" can be used
237.3 gyp ERR! find Python - "python3" is not in PATH or produced an error
237.3 gyp ERR! find Python checking if "python" can be used
237.3 gyp ERR! find Python - "python" is not in PATH or produced an error
237.3 gyp ERR! find Python 
237.3 gyp ERR! find Python **********************************************************
237.3 gyp ERR! find Python You need to install the latest version of Python.
237.3 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
237.3 gyp ERR! find Python you can try one of the following options:
237.3 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
237.3 gyp ERR! find Python   (accepted by both node-gyp and npm)
237.3 gyp ERR! find Python - Set the environment variable PYTHON
237.3 gyp ERR! find Python - Set the npm configuration variable python:
237.3 gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
237.3 gyp ERR! find Python For more information consult the documentation at:
237.3 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
237.3 gyp ERR! find Python **********************************************************
237.3 gyp ERR! find Python 
237.3 gyp ERR! configure error 
237.3 gyp ERR! stack Error: Could not find any Python installation to use
237.3 gyp ERR! stack     at PythonFinder.fail (/tmp/seedplanner/node_modules/node-gyp/lib/find-python.js:330:47)
237.3 gyp ERR! stack     at PythonFinder.runChecks (/tmp/seedplanner/node_modules/node-gyp/lib/find-python.js:159:21)
237.3 gyp ERR! stack     at PythonFinder.<anonymous> (/tmp/seedplanner/node_modules/node-gyp/lib/find-python.js:202:16)
237.3 gyp ERR! stack     at PythonFinder.execFileCallback (/tmp/seedplanner/node_modules/node-gyp/lib/find-python.js:294:16)
237.3 gyp ERR! stack     at exithandler (node:child_process:421:5)
237.3 gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:433:5)
237.3 gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
237.3 gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
237.3 gyp ERR! stack     at onErrorNT (node:internal/child_process:483:16)
237.3 gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
237.3 gyp ERR! System Linux 6.12.5-linuxkit
237.3 gyp ERR! command "/usr/local/bin/node" "/tmp/seedplanner/node_modules/sqlite3/node_modules/.bin/node-gyp" "rebuild"
237.3 gyp ERR! cwd /tmp/seedplanner/node_modules/sqlite3
237.3 gyp ERR! node -v v22.14.0
237.3 gyp ERR! node-gyp -v v8.4.1
237.3 gyp ERR! not ok
237.3 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

@LaurentGoderre
Copy link
Member

Not sure where the N-API error comes from. Running this exact sha for me works

docker run --rm -it node@sha256:5145c882f9e32f07dd7593962045d97f221d57a1b609f5bf7a807eb89deff9d6 yarn add [email protected]         
yarn add v1.22.22
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 35 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
[...]
Done in 2.21s.

@Nic128
Copy link

Nic128 commented Feb 17, 2025

I wonder if the underlying bookworm was updated, cause I had the same python problem. Then had to revert to node:22.13.

docker run --rm -it node:22 sh
# npm install -g canvas

> [email protected] install
> prebuild-install -r napi || node-gyp rebuild

prebuild-install warn install No prebuilt binaries found (target=7 runtime=napi arch=arm64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"

gyp http GET https://nodejs.org/download/release/v22.14.0/node-v22.14.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v22.14.0/node-v22.14.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v22.14.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v22.14.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.cache/node-gyp/22.14.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/22.14.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/22.14.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/canvas',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'pangocairo', required by 'virtual:world', not found
gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:317:18)
gyp ERR! stack at ChildProcess.emit (node:events:518:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 6.10.14-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/canvas
gyp ERR! node -v v22.14.0
gyp ERR! node-gyp -v v11.0.0
gyp ERR! not ok
npm error code 1
npm error path /usr/local/lib/node_modules/canvas
npm error command failed
npm error command sh -c prebuild-install -r napi || node-gyp rebuild
npm notice
npm notice New major version of npm available! 10.9.2 -> 11.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.1.0
npm notice To update run: npm install -g [email protected]
npm notice
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-02-17T16_54_23_594Z-debug-0.log

Then I had to rerun these install commands from the wiki. https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems

Before last friday, these reinstall steps were not needed. I don't think it's the Node image per say, but bookworm itself, maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants