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

Zeromq.js fails to install or build in Alpine docker containers #526

Closed
lostless13 opened this issue Nov 16, 2022 · 2 comments · Fixed by #527
Closed

Zeromq.js fails to install or build in Alpine docker containers #526

lostless13 opened this issue Nov 16, 2022 · 2 comments · Fixed by #527
Labels

Comments

@lostless13
Copy link

Describe the bug
Installing zeromq.js on nodejs docker images fails. It does not use prebuilt binaries which should be available nor is it able to build successfully.

Reproducing
Build using the following docker file:

FROM node:18-alpine
WORKDIR /home
RUN apk add --no-cache cmake python3 make
RUN echo '{"dependencies": { "zeromq": "^6.0.0-beta.9"}}' > package.json
RUN npm install

Produces the following output:

 > [5/5] RUN npm install:
#8 42.59 npm notice
#8 42.59 npm notice New major version of npm available! 8.19.2 -> 9.1.2
#8 42.59 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.1.2>
#8 42.59 npm notice Run `npm install -g [email protected]` to update!
#8 42.60 npm notice
#8 42.60 npm ERR! code 1
#8 42.60 npm ERR! path /home/node_modules/zeromq
#8 42.60 npm ERR! command failed
#8 42.60 npm ERR! command sh -c -- node-gyp-build
#8 42.60 npm ERR! make: Entering directory '/home/node_modules/zeromq/build'
#8 42.60 npm ERR! make: Leaving directory '/home/node_modules/zeromq/build'
#8 42.60 npm ERR! gyp info it worked if it ends with ok
#8 42.60 npm ERR! gyp info using [email protected]
#8 42.60 npm ERR! gyp info using [email protected] | linux | x64
#8 42.60 npm ERR! gyp info find Python using Python version 3.10.8 found at "/usr/bin/python3"
#8 42.60 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
#8 42.60 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
#8 42.60 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v18.12.1/SHASUMS256.txt
#8 42.60 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v18.12.1/SHASUMS256.txt
#8 42.60 npm ERR! gyp info spawn /usr/bin/python3
#8 42.60 npm ERR! gyp info spawn args [
#8 42.60 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#8 42.60 npm ERR! gyp info spawn args   'binding.gyp',
#8 42.60 npm ERR! gyp info spawn args   '-f',
#8 42.60 npm ERR! gyp info spawn args   'make',
#8 42.60 npm ERR! gyp info spawn args   '-I',
#8 42.60 npm ERR! gyp info spawn args   '/home/node_modules/zeromq/build/config.gypi',
#8 42.60 npm ERR! gyp info spawn args   '-I',
#8 42.60 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#8 42.60 npm ERR! gyp info spawn args   '-I',
#8 42.60 npm ERR! gyp info spawn args   '/root/.cache/node-gyp/18.12.1/include/node/common.gypi',
#8 42.60 npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
#8 42.60 npm ERR! gyp info spawn args   '-Dvisibility=default',
#8 42.60 npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/18.12.1',
#8 42.60 npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
#8 42.60 npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.12.1/<(target_arch)/node.lib',
#8 42.60 npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/node_modules/zeromq',
#8 42.60 npm ERR! gyp info spawn args   '-Dnode_engine=v8',
#8 42.60 npm ERR! gyp info spawn args   '--depth=.',
#8 42.60 npm ERR! gyp info spawn args   '--no-parallel',
#8 42.60 npm ERR! gyp info spawn args   '--generator-output',
#8 42.60 npm ERR! gyp info spawn args   'build',
#8 42.60 npm ERR! gyp info spawn args   '-Goutput_dir=.'
#8 42.60 npm ERR! gyp info spawn args ]
#8 42.60 npm ERR! gyp info spawn make
#8 42.60 npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#8 42.60 npm ERR! make: *** No rule to make target '/home/node_modules/zeromq/script/build.ts', needed by '7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate'.  Stop.
#8 42.60 npm ERR! gyp ERR! build error
#8 42.60 npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
#8 42.60 npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
#8 42.60 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#8 42.60 npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
#8 42.60 npm ERR! gyp ERR! System Linux 4.19.128-microsoft-standard
#8 42.60 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#8 42.60 npm ERR! gyp ERR! cwd /home/node_modules/zeromq
#8 42.60 npm ERR! gyp ERR! node -v v18.12.1
#8 42.60 npm ERR! gyp ERR! node-gyp -v v9.1.0
#8 42.60 npm ERR! gyp ERR! not ok

Alternatively, using base docker image:

FROM node
WORKDIR /home
RUN echo '{"dependencies": { "zeromq": "^6.0.0-beta.9"}}' > package.json
RUN npm install

Produces similar error:

 > [4/4] RUN npm install:
#6 5.409 npm notice
#6 5.409 npm notice New major version of npm available! 8.19.3 -> 9.1.2
#6 5.409 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.1.2>
#6 5.409 npm notice Run `npm install -g [email protected]` to update!
#6 5.409 npm notice
#6 5.411 npm ERR! code 1
#6 5.411 npm ERR! path /home/node_modules/zeromq
#6 5.412 npm ERR! command failed
#6 5.412 npm ERR! command sh -c -- node-gyp-build
#6 5.412 npm ERR! make: Entering directory '/home/node_modules/zeromq/build'
#6 5.413 npm ERR! make: Leaving directory '/home/node_modules/zeromq/build'
#6 5.413 npm ERR! gyp info it worked if it ends with ok
#6 5.413 npm ERR! gyp info using [email protected]
#6 5.413 npm ERR! gyp info using [email protected] | linux | x64
#6 5.413 npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
#6 5.413 npm ERR! gyp http GET https://nodejs.org/download/release/v19.1.0/node-v19.1.0-headers.tar.gz
#6 5.413 npm ERR! gyp http 200 https://nodejs.org/download/release/v19.1.0/node-v19.1.0-headers.tar.gz
#6 5.413 npm ERR! gyp http GET https://nodejs.org/download/release/v19.1.0/SHASUMS256.txt
#6 5.414 npm ERR! gyp http 200 https://nodejs.org/download/release/v19.1.0/SHASUMS256.txt
#6 5.414 npm ERR! gyp info spawn /usr/bin/python3
#6 5.414 npm ERR! gyp info spawn args [
#6 5.414 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#6 5.414 npm ERR! gyp info spawn args   'binding.gyp',
#6 5.414 npm ERR! gyp info spawn args   '-f',
#6 5.414 npm ERR! gyp info spawn args   'make',
#6 5.414 npm ERR! gyp info spawn args   '-I',
#6 5.414 npm ERR! gyp info spawn args   '/home/node_modules/zeromq/build/config.gypi',
#6 5.414 npm ERR! gyp info spawn args   '-I',
#6 5.414 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#6 5.415 npm ERR! gyp info spawn args   '-I',
#6 5.415 npm ERR! gyp info spawn args   '/root/.cache/node-gyp/19.1.0/include/node/common.gypi',
#6 5.415 npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
#6 5.415 npm ERR! gyp info spawn args   '-Dvisibility=default',
#6 5.415 npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/19.1.0',
#6 5.415 npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
#6 5.415 npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/19.1.0/<(target_arch)/node.lib',
#6 5.415 npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/node_modules/zeromq',
#6 5.416 npm ERR! gyp info spawn args   '-Dnode_engine=v8',
#6 5.416 npm ERR! gyp info spawn args   '--depth=.',
#6 5.416 npm ERR! gyp info spawn args   '--no-parallel',
#6 5.416 npm ERR! gyp info spawn args   '--generator-output',
#6 5.416 npm ERR! gyp info spawn args   'build',
#6 5.416 npm ERR! gyp info spawn args   '-Goutput_dir=.'
#6 5.416 npm ERR! gyp info spawn args ]
#6 5.416 npm ERR! gyp info spawn make
#6 5.416 npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#6 5.417 npm ERR! make: *** No rule to make target '/home/node_modules/zeromq/script/build.ts', needed by '7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate'.  Stop.
#6 5.417 npm ERR! gyp ERR! build error
#6 5.417 npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
#6 5.417 npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
#6 5.417 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#6 5.417 npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
#6 5.417 npm ERR! gyp ERR! System Linux 4.19.128-microsoft-standard
#6 5.417 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#6 5.417 npm ERR! gyp ERR! cwd /home/node_modules/zeromq
#6 5.418 npm ERR! gyp ERR! node -v v19.1.0
#6 5.418 npm ERR! gyp ERR! node-gyp -v v9.1.0
#6 5.418 npm ERR! gyp ERR! not ok

Expected behavior
Zeromq should install successfully as a dependency.

Tested on

  • OS: Alpine Docker Image and Debian Docker Image
  • ZeroMQ.js version: 6.0.0-beta.9
@lostless13 lostless13 added the bug label Nov 16, 2022
@aminya aminya changed the title Zeromq.js fails to install or build in docker containers Zeromq.js fails to install or build in Alpine docker containers Nov 16, 2022
@aminya
Copy link
Member

aminya commented Nov 16, 2022

Zeromq doens't come with an Alpine prebuild; we can add that. Use an Ubuntu/Debain base until this is fixed.

I don't know why Make gives this error:

make: *** No rule to make target '/home/node_modules/zeromq/script/build.ts'

We can remove this line if it is causing issues. It only helps with rebuilds and caching, which is not necessary in general.
https://github.com/zeromq/zeromq.js/blob/master/binding.gyp#L19

@lostless13
Copy link
Author

The second example I provided uses a Debian image but it still fails in the same way.

FROM node
WORKDIR /home
RUN echo '{"dependencies": { "zeromq": "^6.0.0-beta.9"}}' > package.json
RUN npm install

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

Successfully merging a pull request may close this issue.

2 participants