box / boxcli

A command line interface for interacting with the Box API.
https://developer.box.com
Apache License 2.0
222 stars 59 forks source link

Install box-cli debian 11, nodejs 12.22.12 fails #481

Closed Streifi89 closed 1 year ago

Streifi89 commented 1 year ago

Debian 11, fully updated.

npm install --global @box/cli

root@Docker:~# npm install --global @box/cli npm ERR! code 1 npm ERR! path /usr/local/lib/node_modules/@box/cli/node_modules/keytar 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@7.1.2 npm ERR! gyp info using node@12.22.12 | linux | x64 npm ERR! gyp info find Python using Python version 3.9.2 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/share/nodejs/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/@box/cli/node_modules/keytar/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/share/nodejs/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/include/nodejs/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=/usr/include/nodejs', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/@box/cli/node_modules/keytar', 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! /bin/sh: 1: pkg-config: not found npm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 127 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/share/nodejs/node-gyp/lib/configure.js:355:16) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:314:20) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12) npm ERR! gyp ERR! System Linux 6.2.16-3-pve npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nodejs/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/@box/cli/node_modules/keytar npm ERR! gyp ERR! node -v v12.22.12 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-07-13T12_40_51_400Z-debug.log

Any ideas?

There is no requirements documented https://developer.box.com/guides/cli/quick-start/install-and-configure/ - just "use npm".

mwwoda commented 1 year ago

I tried with a freshly installed Debian 11 and the CLI installation went smoothly.

It looks like the error message indicates that some package is missing

npm ERR! /bin/sh: 1: pkg-config: not found

Could you try to check if it is present on your machine? You can use the following command in terminal:

dpkg-query -l | grep pkg-config

If not, try installing this package and try again. You can also check if libsecret is present. AFAIK it's also required

dpkg-query -l | grep libsecret

Streifi89 commented 1 year ago

Using Debian 11 minimal container template. Maybe of this.. Yes libsecret and pkg-config was missing. Now installed

root@Docker:/home/paperless# dpkg-query -l | grep pkg-config ii pkg-config 0.29.2-1 amd64 manage compile and link flags for libraries

root@Docker:/home/paperless# dpkg-query -l | grep libsecret ii libsecret-1-0:amd64 0.20.4-2 amd64 Secret store ii libsecret-common 0.20.4-2 all Secret store (common files) ii libsecret-tools 0.20.4-2 amd64 tool for storing and retrieving GObject passwords

Unfortunately did not help

root@Docker:/home/paperless# npm install --global @box/cli

npm ERR! code 1 npm ERR! path /usr/local/lib/node_modules/@box/cli/node_modules/keytar 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@7.1.2 npm ERR! gyp info using node@12.22.12 | linux | x64 npm ERR! gyp info find Python using Python version 3.9.2 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/share/nodejs/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/@box/cli/node_modules/keytar/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/share/nodejs/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/include/nodejs/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=/usr/include/nodejs', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/@box/cli/node_modules/keytar', 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! Package libsecret-1 was not found in the pkg-config search path. npm ERR! Perhaps you should add the directory containing libsecret-1.pc' npm ERR! to the PKG_CONFIG_PATH environment variable npm ERR! No package 'libsecret-1' found npm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' 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/share/nodejs/node-gyp/lib/configure.js:355:16) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:314:20) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12) npm ERR! gyp ERR! System Linux 6.2.16-3-pve npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nodejs/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/@box/cli/node_modules/keytar npm ERR! gyp ERR! node -v v12.22.12 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! /root/.

mwwoda commented 1 year ago

I guess the minimal container template is missing some dependencies. Error is similar to the https://github.com/atom/node-keytar/issues/69. We use keytar too.

Try sudo apt-get install libsecret-1-dev

Streifi89 commented 1 year ago

That was the last problem :)

Streifi89 commented 1 year ago

closed :)

Evidlo commented 1 year ago

It was not enough to just install libsecret for me. I had to modify PKG_CONFIG_PATH as suggested in the error message.

[evan@blackbox keytar] locate libsecret-1.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libsecret-1.pc
[evan@blackbox boxcli] export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/
[evan@blackbox boxcli] npm install --global @box/cli

changed 391 packages in 14s