Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

npm install on Docker fails to load binary, builds from source, fails #168

@ak-beam

Description

@ak-beam

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

SDK Version

"@sentry/node": "7.55.2", "@sentry/profiling-node": "1.0.4"

Link to Sentry event

No response

What environment is your node script running in?

Docker image: node:18.14.0
MacOS: 13.4 (22F66)
Apple M1 Pro

How is your code deployed and bundled?

Local dev runs app within Docker w/ docker-compose

Dockerfile

FROM node:18.14.0
WORKDIR /app
COPY package.json .
COPY apps ./apps
COPY packages ./packages
COPY ./.env .
RUN npm install --include=optional

Steps to Reproduce

  • Have an Apple Silicon Mac (M1/M2) as the host machine
  • npm install -D @sentry/profiling-node to add package to project
  • npm install as a Docker step

Expected Result

NPM install finds prebuilt binary and succeeds

Actual Result

NPM Install Error
0 105.1 npm ERR! code 1
#0 105.1 npm ERR! path /app/node_modules/@sentry/profiling-node
#0 105.1 npm ERR! command failed
#0 105.1 npm ERR! command sh -c node scripts/check-build.mjs
#0 105.1 npm ERR! @sentry/profiling-node: Precompiled binary found, attempting to load...
#0 105.1 npm ERR! @sentry/profiling-node: Precompiled binary found but failed loading
#0 105.1 npm ERR! @sentry/profiling-node: Compiling from source...
#0 105.1 npm ERR! gyp info it worked if it ends with ok
#0 105.1 npm ERR! gyp info using node-gyp@9.4.0
#0 105.1 npm ERR! gyp info using node@18.14.0 | linux | arm64
#0 105.1 npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
#0 105.1 npm ERR! gyp http GET https://nodejs.org/download/release/v18.14.0/node-v18.14.0-headers.tar.gz
#0 105.1 npm ERR! gyp http 200 https://nodejs.org/download/release/v18.14.0/node-v18.14.0-headers.tar.gz
#0 105.1 npm ERR! gyp http GET https://nodejs.org/download/release/v18.14.0/SHASUMS256.txt
#0 105.1 npm ERR! gyp http 200 https://nodejs.org/download/release/v18.14.0/SHASUMS256.txt
#0 105.1 npm ERR! gyp info spawn /usr/bin/python3
#0 105.1 npm ERR! gyp info spawn args [
#0 105.1 npm ERR! gyp info spawn args   '/app/node_modules/node-gyp/gyp/gyp_main.py',
#0 105.1 npm ERR! gyp info spawn args   'binding.gyp',
#0 105.1 npm ERR! gyp info spawn args   '-f',
#0 105.1 npm ERR! gyp info spawn args   'make',
#0 105.1 npm ERR! gyp info spawn args   '-I',
#0 105.1 npm ERR! gyp info spawn args   '/app/node_modules/@sentry/profiling-node/build/config.gypi',
#0 105.1 npm ERR! gyp info spawn args   '-I',
#0 105.1 npm ERR! gyp info spawn args   '/app/node_modules/node-gyp/addon.gypi',
#0 105.1 npm ERR! gyp info spawn args   '-I',
#0 105.1 npm ERR! gyp info spawn args   '/root/.cache/node-gyp/18.14.0/include/node/common.gypi',
#0 105.1 npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
#0 105.1 npm ERR! gyp info spawn args   '-Dvisibility=default',
#0 105.1 npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/18.14.0',
#0 105.1 npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/app/node_modules/node-gyp',
#0 105.1 npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.14.0/<(target_arch)/node.lib',
#0 105.1 npm ERR! gyp info spawn args   '-Dmodule_root_dir=/app/node_modules/@sentry/profiling-node',
#0 105.1 npm ERR! gyp info spawn args   '-Dnode_engine=v8',
#0 105.1 npm ERR! gyp info spawn args   '--depth=.',
#0 105.1 npm ERR! gyp info spawn args   '--no-parallel',
#0 105.1 npm ERR! gyp info spawn args   '--generator-output',
#0 105.1 npm ERR! gyp info spawn args   'build',
#0 105.1 npm ERR! gyp info spawn args   '-Goutput_dir=.'
#0 105.1 npm ERR! gyp info spawn args ]
#0 105.1 npm ERR! gyp info ok
#0 105.1 npm ERR! gyp info it worked if it ends with ok
#0 105.1 npm ERR! gyp info using node-gyp@9.4.0
#0 105.1 npm ERR! gyp info using node@18.14.0 | linux | arm64
#0 105.1 npm ERR! gyp info spawn make
#0 105.1 npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#0 105.1 npm ERR! gyp info ok
#0 105.1 npm ERR! node:fs:1039
#0 105.1 npm ERR!   handleErrorFromBinding(ctx);
#0 105.1 npm ERR!   ^
#0 105.1 npm ERR!
#0 105.1 npm ERR! Error: ENOENT: no such file or directory, rename '/app/node_modules/@sentry/profiling-node/build/Release/sentry_cpu_profiler.node' -> '/app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node'
#0 105.1 npm ERR!     at Object.renameSync (node:fs:1039:3)
#0 105.1 npm ERR!     at file:///app/node_modules/@sentry/profiling-node/scripts/copy-target.mjs:18:4
#0 105.1 npm ERR!     at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
#0 105.1 npm ERR!   errno: -2,
#0 105.1 npm ERR!   syscall: 'rename',
#0 105.1 npm ERR!   code: 'ENOENT',
#0 105.1 npm ERR!   path: '/app/node_modules/@sentry/profiling-node/build/Release/sentry_cpu_profiler.node',
#0 105.1 npm ERR!   dest: '/app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node'
#0 105.1 npm ERR! }
#0 105.1 npm ERR!
#0 105.1 npm ERR! Node.js v18.14.0
#0 105.2 npm ERR! @sentry/profiling-node: Failed to build from source, please report this a bug at https://github.com/getsentry/profiling-node/issues/new?assignees=&labels=Type%3A+Bug&template=bug.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions