docker-registry-ui icon indicating copy to clipboard operation
docker-registry-ui copied to clipboard

Electron build failure related to keytar

Open maxhgerlach opened this issue 4 years ago • 4 comments
trafficstars

Hi, I'm not very savvy with Node development, but ran into an issue trying to build the standalone electron version, following the instructions at https://github.com/Joxit/docker-registry-ui/tree/main/examples/electron/README.md .

Bug description

npm run dist fails with C++ build errors building the module keytar:

docker-registry-ui/examples/electron$ npm run dist

> [email protected] dist
> npm run rebuild && npm run sync && npm run build && npm run package

npm WARN npm npm does not support Node.js v16.5.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/

> [email protected] rebuild /Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron
> electron-rebuild -f -w keytar

⠇ Building module: keytar, Completed: 0(node:36685) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
⠙ Building module: keytar, Completed: 0  CXX(target) Release/obj.target/keytar/src/async.o
⠸ Building module: keytar, Completed: 0In file included from ../src/async.cc:4:
In file included from ../node_modules/node-addon-api/napi.h:2725:
../node_modules/node-addon-api/napi-inl.h:1393:24: error: use of undeclared identifier 'napi_object_freeze'
  napi_status status = napi_object_freeze(_env, _value);
                       ^
../node_modules/node-addon-api/napi-inl.h:1399:24: error: use of undeclared identifier 'napi_object_seal'
  napi_status status = napi_object_seal(_env, _value);
                       ^
../node_modules/node-addon-api/napi-inl.h:1606:24: error: use of undeclared identifier 'napi_is_detached_arraybuffer'; did you mean 'napi_is_arraybuffer'?
  napi_status status = napi_is_detached_arraybuffer(_env, _value, &detached);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       napi_is_arraybuffer
/Users/maxgerlach/.electron-gyp/11.5.0/include/node/js_native_api.h:383:25: note: 'napi_is_arraybuffer' declared here
NAPI_EXTERN napi_status napi_is_arraybuffer(napi_env env,
                        ^
In file included from ../src/async.cc:4:
In file included from ../node_modules/node-addon-api/napi.h:2725:
../node_modules/node-addon-api/napi-inl.h:1612:24: error: use of undeclared identifier 'napi_detach_arraybuffer'
  napi_status status = napi_detach_arraybuffer(_env, _value);
                       ^
4 errors generated.
make: *** [Release/obj.target/keytar/src/async.o] Error 1
✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron/node_modules/keytar'.
Error: `make` failed with exit code: 2



Error: node-gyp failed to rebuild '/Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron/node_modules/keytar'.
Error: `make` failed with exit code: 2


    at ModuleRebuilder.rebuildNodeGypModule (/Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron/node_modules/electron-rebuild/lib/src/module-rebuilder.js:193:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Rebuilder.rebuildModuleAt (/Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron/node_modules/electron-rebuild/lib/src/rebuild.js:190:9)
    at async Rebuilder.rebuild (/Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron/node_modules/electron-rebuild/lib/src/rebuild.js:152:17)
    at async /Users/maxgerlach/thirdparty/docker-registry-ui/examples/electron/node_modules/electron-rebuild/lib/src/cli.js:146:9
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] rebuild: `electron-rebuild -f -w keytar`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/maxgerlach/.npm/_logs/2021-09-15T17_36_01_442Z-debug.log
max@mmbp:~/thirdparty/docker-registry-ui/examples/electron$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   ../../dist/docker-registry-ui.js
	modified:   ../../package.json

no changes added to commit (use "git add" and/or "git commit -a")
max@mmbp:~/thirdparty/docker-registry-ui/examples/electron$ git log -n 1
commit 21e3ad51afedec24fc9e1761afbcd399a0544686 (HEAD -> main, tag: 2.0.9, origin/main, origin/HEAD)
Author: Joxit <[email protected]>
Date:   Mon Sep 13 09:14:00 2021

    fix(warn): Refused to get unsafe header "www-authenticate"

System information

  • OS: macOS 11.5.1
  • Docker registry UI:
    • Version: main branch, just checked out
$ git log -n 1
commit 21e3ad51afedec24fc9e1761afbcd399a0544686 (HEAD -> main, tag: 2.0.9, origin/main, origin/HEAD)
Author: Joxit <[email protected]>
Date:   Mon Sep 13 09:14:00 2021

    fix(warn): Refused to get unsafe header "www-authenticate"

maxhgerlach avatar Sep 15 '21 17:09 maxhgerlach

Ran into the same issue. What I did, after playing around for a while, was simply remove keytar references as I didn't need it :D

After that I noticed that my registry url wasn't being used for some reason? So I manually updated ${REGISTRY_URL} in the index.html file.

Rebuild and run ...

Thanks !

johnpoth avatar Sep 21 '21 11:09 johnpoth

Hi, thank you for using my project.

I'm sorry, the original contributor of the electron example was @agrippa1994 and I did't test it with the v2.0 of the project... :confused:

Joxit avatar Oct 16 '21 06:10 Joxit

Btw, I am able to build unmodified using Node 12.x, but 14.x and 16.x result in the error above. But yes @johnpoth there is basically nothing in there to replace ENV variables. Looks like the bin/entrypoint does it for docker images, but not so much for the electron stuff

arimus avatar Dec 11 '21 23:12 arimus

Btw, I am able to build unmodified using Node 12.x, but 14.x and 16.x result in the error above. But yes @johnpoth there is basically nothing in there to replace ENV variables. Looks like the bin/entrypoint does it for docker images, but not so much for the electron stuff

Thanks! Version 12.13 worked

extragornax avatar Jun 15 '23 10:06 extragornax