question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: argon2 can't rebuild at alpine 3.15 node 16

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser:
  • Local OS: Windows
  • Remote OS: Alpine
  • Remote Architecture: amd64
  • code-server --version: 4.4.0

Steps to Reproduce

  1. docker run -it alpine:3.15 sh
  2. apk add make g++ nodejs yarn npm
  3. npm install -g code-server --unsafe-perm

Expected

install successful

Actual

fail to install argon2

Logs

npm install -g code-server --unsafe-perm
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/code-server/node_modules/argon2
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@16.14.2 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.7 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/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/code-server/node_modules/argon2/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/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.14.2/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.14.2',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.14.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/code-server/node_modules/argon2',
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! node:internal/modules/cjs/loader:936
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module 'node-addon-api'
npm ERR! Require stack:
npm ERR! - /usr/local/lib/node_modules/code-server/node_modules/argon2/[eval]
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1005:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR!     at [eval]:1:1
npm ERR!     at Script.runInThisContext (node:vm:129:12)
npm ERR!     at Object.runInThisContext (node:vm:305:38)
npm ERR!     at node:internal/process/execution:76:19
npm ERR!     at [eval]-wrapper:6:22
npm ERR!     at evalScript (node:internal/process/execution:75:60) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: [
npm ERR!     '/usr/local/lib/node_modules/code-server/node_modules/argon2/[eval]'
npm ERR!   ]
npm ERR! }
npm ERR! gyp: Call to 'node -p "require('node-addon-api').include"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 3.10.0-1062.18.1.el7.x86_64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/code-server/node_modules/argon2
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-05-10T02_13_13_041Z-debug.log

Screenshot/Video

No response

Does this issue happen in VS Code?

  • I cannot reproduce this in VS Code.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
kernie66commented, Jun 19, 2022

I’d say it is related to #5174. I have the same problem and error with npm on the Raspberry Pi. I got it working by using ‘–ignore_scripts’ with npm and do a manual install to get ‘postinstall.sh’ to run. Then the errors led me to argon2. I had to go down to argon2, do ‘npm install’, do ‘npm update’ and then add any missing node modules that code-server complained about.

Without ‘–ignore_scripts’, code-server is removed at the end of the installation so you cannot debug it.

So the main problem seems to be that argon2 does not get built on my Raspberry Pi when installing code-server. It is the same problem, but with slightly different errors, when I install it locally and globally.

1reaction
kernie66commented, Jun 20, 2022

Tried to install it with yarn as suggested in #5174 and it seemed to work. But for some reason it didn’t find the git repository in the folder. Returning to my ‘–ignore_scripts’ installation and git works again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker Node Alpine Image Build Fails on node-gyp
js application. I'm using the node:10.15-alpine Docker image as a base. The image build fails with the following error: gyp ...
Read more >
PHP 7 ChangeLog
Fixed bug #81727: Don't mangle HTTP variable names that clash with ones that have a specific semantic meaning. (CVE-2022-31629). Version 7.4.30. 09 Jun...
Read more >
How to install npm in alpine linux - Super User
Side question: while this answer works just fine, I can't seem to find nodejs-npm on pkgs.alpinelinux.org/packages. There is npm package which ...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/24 17 ...
Bug :128538 - "sys-apps/coreutils: /bin/hostname should be installed from ... to yuy2_to_yv16 and yuy2_to_yv12)" status:UNCONFIRMED resolution: severity: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found