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

mac m1 bcrypt@5.0.1 install: node-pre-gyp install --fallback-to-build #868

Closed
Cucak opened this issue Apr 27, 2021 · 32 comments
Closed

mac m1 bcrypt@5.0.1 install: node-pre-gyp install --fallback-to-build #868

Cucak opened this issue Apr 27, 2021 · 32 comments

Comments

@Cucak
Copy link

Cucak commented Apr 27, 2021

=> ERROR [dependencies 3/5] RUN npm install --production=false 14.4s

[dependencies 3/5] RUN npm install --production=false:
#12 13.35
#12 13.35 > bcrypt@5.0.1 install /usr/src/app/node_modules/bcrypt
#12 13.35 > node-pre-gyp install --fallback-to-build
#12 13.35
#12 13.72 node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-glibc.tar.gz
#12 13.72 node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@14.15.5 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
#12 13.72 node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-glibc.tar.gz
#12 13.86 gyp ERR! find Python
#12 13.86 gyp ERR! find Python Python is not set from command line or npm configuration
#12 13.86 gyp ERR! find Python Python is not set from environment variable PYTHON
#12 13.86 gyp ERR! find Python checking if "python" can be used
#12 13.86 gyp ERR! find Python - "python" is not in PATH or produced an error
#12 13.86 gyp ERR! find Python checking if "python2" can be used
#12 13.86 gyp ERR! find Python - "python2" is not in PATH or produced an error
#12 13.86 gyp ERR! find Python checking if "python3" can be used
#12 13.86 gyp ERR! find Python - "python3" is not in PATH or produced an error
#12 13.86 gyp ERR! find Python
#12 13.86 gyp ERR! find Python **********************************************************
#12 13.86 gyp ERR! find Python You need to install the latest version of Python.
#12 13.86 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#12 13.86 gyp ERR! find Python you can try one of the following options:
#12 13.86 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#12 13.86 gyp ERR! find Python (accepted by both node-gyp and npm)
#12 13.86 gyp ERR! find Python - Set the environment variable PYTHON
#12 13.86 gyp ERR! find Python - Set the npm configuration variable python:
#12 13.86 gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
#12 13.86 gyp ERR! find Python For more information consult the documentation at:
#12 13.86 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#12 13.86 gyp ERR! find Python **********************************************************
#12 13.86 gyp ERR! find Python
#12 13.86 gyp ERR! configure error
#12 13.86 gyp ERR! stack Error: Could not find any Python installation to use
#12 13.86 gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
#12 13.86 gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
#12 13.86 gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
#12 13.86 gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
#12 13.86 gyp ERR! stack at exithandler (child_process.js:315:5)
#12 13.86 gyp ERR! stack at ChildProcess.errorhandler (child_process.js:327:5)
#12 13.86 gyp ERR! stack at ChildProcess.emit (events.js:315:20)
#12 13.86 gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
#12 13.86 gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
#12 13.86 gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
#12 13.86 gyp ERR! System Linux 5.10.25-linuxkit
#12 13.86 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
#12 13.86 gyp ERR! cwd /usr/src/app/node_modules/bcrypt
#12 13.86 gyp ERR! node -v v14.15.5
#12 13.86 gyp ERR! node-gyp -v v5.1.0
#12 13.86 gyp ERR! not ok
#12 13.86 node-pre-gyp ERR! build error
#12 13.86 node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#12 13.86 node-pre-gyp ERR! stack at ChildProcess. (/usr/src/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#12 13.86 node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
#12 13.86 node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
#12 13.86 node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
#12 13.86 node-pre-gyp ERR! System Linux 5.10.25-linuxkit
#12 13.86 node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/src/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#12 13.86 node-pre-gyp ERR! cwd /usr/src/app/node_modules/bcrypt
#12 13.86 node-pre-gyp ERR! node -v v14.15.5
#12 13.86 node-pre-gyp ERR! node-pre-gyp -v v1.0.4
#12 13.86 node-pre-gyp ERR! not ok
#12 13.86 Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#12 14.17 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
#12 14.17 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#12 14.17
#12 14.24 npm ERR! code ELIFECYCLE
#12 14.24 npm ERR! errno 1
#12 14.24 npm ERR! bcrypt@5.0.1 install: node-pre-gyp install --fallback-to-build
#12 14.24 npm ERR! Exit status 1
#12 14.24 npm ERR!
#12 14.24 npm ERR! Failed at the bcrypt@5.0.1 install script.
#12 14.24 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I am using mac m1 and basically tried reinstalling whole my setup, I tried different node packages as well.
I need to know if this package should not have problem with mac m1 cpu?

@recrsn
Copy link
Collaborator

recrsn commented Apr 28, 2021

We do not have pre-compiled version for m1 so you will need to setup Python and Xcode to compile it from source.

Our CI doesn't have M1 and I do not have a M1 Mac as well. So this will be the state for quite some time.

@JEK58
Copy link

JEK58 commented May 2, 2021

Hm, isn't this because the arm64 version is not included in the latest release? (5.0.0 has it)
That should be enough to run it on an M1.

Maybe try 5.0.0 and see if it resolves the problem.

@recrsn Is there a reason for the absence of arm64 in the latest release?

@Harthor
Copy link

Harthor commented May 3, 2021

I'm getting a similar error, tried using 5.0.0 but still not working,

We do not have pre-compiled version for m1 so you will need to setup Python and Xcode to compile it from source.

Our CI doesn't have M1 and I do not have a M1 Mac as well. So this will be the state for quite some time.

How can I do this?

@recrsn
Copy link
Collaborator

recrsn commented May 3, 2021

@recrsn
Copy link
Collaborator

recrsn commented May 3, 2021

@JEK58 We do not have macos-arm64 support on 5.0.0 It has experimental linux-arm64 binaries

Until CIs have arm64 offerings, I'll need to procure an ARM mac to build them.

@Cucak
Copy link
Author

Cucak commented May 4, 2021

@Harthor https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions

I have installed both python2 and C++. If I could help you guys somehow to find out the issue together, you can count on me. I mean arm64 is not something that's going to be gone, it's the future, that's why I think everyone should take it more seriously to get packages updated... to build it from source, it requires python, which is not available inside the docker image in my case

@Harthor
Copy link

Harthor commented May 10, 2021

@Harthor https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions

Not sure if I'm not realizing and one of those could be used for mac, or there is no instructions for mac.
I'm currently on a new macbook air with the Apple M1 chip, that's why I think it's not working, but haven't found any solution so far =(

@recrsn
Copy link
Collaborator

recrsn commented May 10, 2021

@Harthor you only need XCode command line tools

@Harthor
Copy link

Harthor commented May 12, 2021

@Harthor you only need XCode command line tools

Downloaded it, still getting same error, should I do something else besides installing it?

@recrsn
Copy link
Collaborator

recrsn commented May 12, 2021

Are you able to run make and g++?

@Harthor
Copy link

Harthor commented May 12, 2021

Are you able to run make and g++?

The error happens when using yarn to install a whole bunch of dependencies, amongst them is included bcrypt, I'm not sure where you mean I should run make.
In case it's useful, here is a copy of the logs

[4/4] 🔨 Building fresh packages...
[12/25] ⠠ bcrypto
[-/25] ⠠ waiting...
[-/25] ⠠ waiting...
[-/25] ⠠ waiting...
error /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@14.16.1 | darwin | x64
gyp info find Python using Python version 3.9.4 found at "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"
gyp info spawn /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1',
gyp info spawn args '-Dnode_gyp_dir=/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/bcrypto/src/torsion/src/aead.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/chacha20.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/drbg.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/dsa.o
In file included from ../src/torsion/src/dsa.c:34:
In file included from ../src/torsion/src/asn1.h:13:
In file included from ../src/torsion/src/mpz.h:20:
../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
mpn_tdiv_qr(mp_limb_t *qp,
^
../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
mpn_gcdext(mp_limb_t *gp,
^
In file included from ../src/torsion/src/dsa.c:34:
In file included from ../src/torsion/src/asn1.h:13:
../src/torsion/src/mpz.h:456:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
^
../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
#define mpz_random_prime torsion_mpz_random_prime
^
In file included from ../src/torsion/src/dsa.c:34:
../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
asn1_read_int(unsigned char *out, size_t out_len,
^
../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
asn1_size_int(const unsigned char *num, size_t len) {
^
../src/torsion/src/asn1.h:331:1: warning: unused function 'asn1_write_int' [-Wunused-function]
asn1_write_int(unsigned char *data, size_t pos,
^
6 warnings generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/ecc.o
In file included from ../src/torsion/src/ecc.c:158:
In file included from ../src/torsion/src/asn1.h:13:
In file included from ../src/torsion/src/mpz.h:20:
../src/torsion/src/gmp-compat.h:103:1: warning: unused function 'mpz_powm_sec' [-Wunused-function]
mpz_powm_sec(mpz_t rop, const mpz_t base, const mpz_t exp, const mpz_t mod) {
^
In file included from ../src/torsion/src/ecc.c:158:
In file included from ../src/torsion/src/asn1.h:13:
../src/torsion/src/mpz.h:42:1: warning: unused function 'torsion_mpz_roset' [-Wunused-function]
mpz_roset(mpz_t r, const mpz_t x) {
^
../src/torsion/src/mpz.h:25:19: note: expanded from macro 'mpz_roset'
#define mpz_roset torsion_mpz_roset
^
../src/torsion/src/mpz.h:83:1: warning: unused function 'torsion_mpz_export_pad' [-Wunused-function]
mpz_export_pad(unsigned char *out, const mpz_t n, size_t size, int endian) {
^
../src/torsion/src/mpz.h:28:24: note: expanded from macro 'mpz_export_pad'
#define mpz_export_pad torsion_mpz_export_pad
^
../src/torsion/src/mpz.h:456:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
^
../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
#define mpz_random_prime torsion_mpz_random_prime
^
In file included from ../src/torsion/src/ecc.c:158:
../src/torsion/src/asn1.h:204:1: warning: unused function 'asn1_read_version' [-Wunused-function]
asn1_read_version(const unsigned char **data, size_t *len,
^
../src/torsion/src/asn1.h:235:1: warning: unused function 'asn1_read_dumb' [-Wunused-function]
asn1_read_dumb(mpz_t n, const unsigned char **data, size_t *len) {
^
../src/torsion/src/asn1.h:286:1: warning: unused function 'asn1_size_mpz' [-Wunused-function]
asn1_size_mpz(const mpz_t n) {
^
../src/torsion/src/asn1.h:301:1: warning: unused function 'asn1_size_version' [-Wunused-function]
asn1_size_version(unsigned char version) {
^
../src/torsion/src/asn1.h:365:1: warning: unused function 'asn1_write_mpz' [-Wunused-function]
asn1_write_mpz(unsigned char *data, size_t pos, const mpz_t n) {
^
../src/torsion/src/asn1.h:395:1: warning: unused function 'asn1_write_version' [-Wunused-function]
asn1_write_version(unsigned char *data, size_t pos, unsigned char version) {
^
../src/torsion/src/asn1.h:403:1: warning: unused function 'asn1_write_dumb' [-Wunused-function]
asn1_write_dumb(unsigned char *data, size_t pos, const mpz_t n) {
^
../src/torsion/src/ecc.c:526:1: warning: unused function 'bytes_equal' [-Wunused-function]
bytes_equal(const unsigned char *a,
^
../src/torsion/src/ecc.c:562:1: warning: unused function 'bytes_lte' [-Wunused-function]
bytes_lte(const unsigned char *a,
^
../src/torsion/src/ecc.c:688:1: warning: unused function 'sc_swap' [-Wunused-function]
sc_swap(scalar_field_t *sc, sc_t a, sc_t b, unsigned int flag) {
^
../src/torsion/src/ecc.c:808:1: warning: unused function 'sc_sub' [-Wunused-function]
sc_sub(scalar_field_t *sc, sc_t r, const sc_t a, const sc_t b) {
^
../src/torsion/src/ecc.c:1760:1: warning: unused function 'fe_random' [-Wunused-function]
fe_random(prime_field_t *fe, fe_t x, drbg_t *rng) {
^
../src/torsion/src/ecc.c:2090:1: warning: unused function 'wge_swap' [-Wunused-function]
wge_swap(wei_t *ec, wge_t *a, wge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:2130:1: warning: unused function 'wge_equal' [-Wunused-function]
wge_equal(wei_t *ec, const wge_t *a, const wge_t *b) {
^
../src/torsion/src/ecc.c:2158:1: warning: unused function 'wge_is_square_var' [-Wunused-function]
wge_is_square_var(wei_t *ec, const wge_t *p) {
^
../src/torsion/src/ecc.c:2166:1: warning: unused function 'wge_equal_x' [-Wunused-function]
wge_equal_x(wei_t *ec, const wge_t *p, const fe_t x) {
^
../src/torsion/src/ecc.c:2325:1: warning: unused function 'wge_dbl' [-Wunused-function]
wge_dbl(wei_t *ec, wge_t *r, const wge_t *p) {
^
../src/torsion/src/ecc.c:2469:1: warning: unused function 'jge_swap' [-Wunused-function]
jge_swap(wei_t *ec, jge_t *a, jge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:2507:1: warning: unused function 'jge_equal' [-Wunused-function]
jge_equal(wei_t *ec, const jge_t *a, const jge_t *b) {
^
../src/torsion/src/ecc.c:2538:1: warning: unused function 'jge_is_square' [-Wunused-function]
jge_is_square(wei_t *ec, const jge_t *p) {
^
../src/torsion/src/ecc.c:2629:1: warning: unused function 'jge_neg_cond' [-Wunused-function]
jge_neg_cond(wei_t *ec, jge_t *r, const jge_t *a, unsigned int flag) {
^
../src/torsion/src/ecc.c:3163:1: warning: unused function 'jge_sub' [-Wunused-function]
jge_sub(wei_t *ec, jge_t *r, const jge_t *a, const jge_t *b) {
^
../src/torsion/src/ecc.c:3311:1: warning: unused function 'jge_mixed_sub' [-Wunused-function]
jge_mixed_sub(wei_t *ec, jge_t *r, const jge_t *a, const wge_t *b) {
^
../src/torsion/src/ecc.c:3387:1: warning: unused function 'jge_validate' [-Wunused-function]
jge_validate(wei_t *ec, const jge_t *p) {
^
../src/torsion/src/ecc.c:4211:1: warning: unused function 'wei_mul_multi_var' [-Wunused-function]
wei_mul_multi_var(wei_t *ec,
^
../src/torsion/src/ecc.c:4729:1: warning: unused function 'mge_zero' [-Wunused-function]
mge_zero(mont_t *ec, mge_t *r) {
^
../src/torsion/src/ecc.c:4747:1: warning: unused function 'mge_validate' [-Wunused-function]
mge_validate(mont_t *ec, const mge_t *p) {
^
../src/torsion/src/ecc.c:4827:1: warning: unused function 'mge_swap' [-Wunused-function]
mge_swap(mont_t *ec, mge_t *a, mge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:4841:1: warning: unused function 'mge_set' [-Wunused-function]
mge_set(mont_t *ec, mge_t *r, const mge_t *a) {
^
../src/torsion/src/ecc.c:4850:1: warning: unused function 'mge_equal' [-Wunused-function]
mge_equal(mont_t *ec, const mge_t *a, const mge_t *b) {
^
../src/torsion/src/ecc.c:4868:1: warning: unused function 'mge_is_zero' [-Wunused-function]
mge_is_zero(mont_t *ec, const mge_t *a) {
^
../src/torsion/src/ecc.c:4882:1: warning: unused function 'mge_dbl' [-Wunused-function]
mge_dbl(mont_t *ec, mge_t *r, const mge_t *p) {
^
../src/torsion/src/ecc.c:5149:1: warning: unused function 'pge_equal' [-Wunused-function]
pge_equal(mont_t *ec, const pge_t *a, const pge_t *b) {
^
../src/torsion/src/ecc.c:5874:1: warning: unused function 'xge_swap' [-Wunused-function]
xge_swap(edwards_t *ec, xge_t *a, xge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:5947:1: warning: unused function 'xge_neg_cond' [-Wunused-function]
xge_neg_cond(edwards_t *ec, xge_t *r, const xge_t *a, unsigned int flag) {
^
../src/torsion/src/ecc.c:6135:1: warning: unused function 'xge_normalize' [-Wunused-function]
xge_normalize(edwards_t *ec, xge_t *r, const xge_t *p) {
^
../src/torsion/src/ecc.c:6159:1: warning: unused function 'xge_normalize_var' [-Wunused-function]
xge_normalize_var(edwards_t *ec, xge_t *r, const xge_t *p) {
^
41 warnings generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/hash.o
../src/torsion/src/hash.c:68:1: warning: unused function 'read64be' [-Wunused-function]
read64be(const void *src) {
^
1 warning generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/kdf.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/poly1305.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/rsa.o
In file included from ../src/torsion/src/rsa.c:29:
In file included from ../src/torsion/src/asn1.h:13:
In file included from ../src/torsion/src/mpz.h:20:
../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
mpn_tdiv_qr(mp_limb_t *qp,
^
../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
mpn_gcdext(mp_limb_t *gp,
^
In file included from ../src/torsion/src/rsa.c:29:
../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
asn1_read_int(unsigned char *out, size_t out_len,
^
../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
asn1_size_int(const unsigned char *num, size_t len) {
^
../src/torsion/src/asn1.h:331:1: warning: unused function 'asn1_write_int' [-Wunused-function]
asn1_write_int(unsigned char *data, size_t pos,
^
../src/torsion/src/rsa.c:1024:1: warning: unused function 'rsa_pub_set' [-Wunused-function]
rsa_pub_set(rsa_pub_t *r, const rsa_pub_t *k) {
^
6 warnings generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/salsa20.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/siphash.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/util.o
CC(target) Release/obj.target/bcrypto/src/base58/base58.o
CC(target) Release/obj.target/bcrypto/src/bech32/bech32.o
CC(target) Release/obj.target/bcrypto/src/cash32/cash32.o
CC(target) Release/obj.target/bcrypto/src/murmur3/murmur3.o
CXX(target) Release/obj.target/bcrypto/src/aead.o
CXX(target) Release/obj.target/bcrypto/src/base58.o
CXX(target) Release/obj.target/bcrypto/src/bech32.o
CXX(target) Release/obj.target/bcrypto/src/bcrypto.o
CXX(target) Release/obj.target/bcrypto/src/blake2b.o
CXX(target) Release/obj.target/bcrypto/src/blake2s.o
CXX(target) Release/obj.target/bcrypto/src/cash32.o
CXX(target) Release/obj.target/bcrypto/src/chacha20.o
CXX(target) Release/obj.target/bcrypto/src/dsa.o
CXX(target) Release/obj.target/bcrypto/src/dsa_async.o
CXX(target) Release/obj.target/bcrypto/src/ecdh.o
CXX(target) Release/obj.target/bcrypto/src/ecdsa.o
CXX(target) Release/obj.target/bcrypto/src/eddsa.o
CXX(target) Release/obj.target/bcrypto/src/hash.o
CXX(target) Release/obj.target/bcrypto/src/hmac.o
CXX(target) Release/obj.target/bcrypto/src/keccak.o
CXX(target) Release/obj.target/bcrypto/src/murmur3.o
CXX(target) Release/obj.target/bcrypto/src/pbkdf2.o
CXX(target) Release/obj.target/bcrypto/src/pbkdf2_async.o
CXX(target) Release/obj.target/bcrypto/src/poly1305.o
CXX(target) Release/obj.target/bcrypto/src/rsa.o
CXX(target) Release/obj.target/bcrypto/src/rsa_async.o
CXX(target) Release/obj.target/bcrypto/src/salsa20.o
CXX(target) Release/obj.target/bcrypto/src/scrypt.o
CXX(target) Release/obj.target/bcrypto/src/scrypt_async.o
CXX(target) Release/obj.target/bcrypto/src/siphash.o
CXX(target) Release/obj.target/bcrypto/src/util.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/mini-gmp.o
CC(target) Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o
In file included from ../src/secp256k1/src/secp256k1.c:12:
In file included from ../src/secp256k1/src/scalar_impl.h:20:
../src/secp256k1/src/scalar_4x64_impl.h:969:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
memcpy((void *) seed32, (const void *) seed, 32);
^
../src/secp256k1/src/scalar_4x64_impl.h:969:5: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
1 error generated.
make: *** [Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/Users/gastonneedleman/.nvm/versions/node/v14.16.1/bin/node" "/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto

@recrsn
Copy link
Collaborator

recrsn commented May 12, 2021

Looks like it's a different module bcrypto which hasn't been updated to work with m1 CPU. It does a bunch of assembly stuff from the looks of it.

It's a different module than bcrypt

@Harthor
Copy link

Harthor commented May 12, 2021

Looks like it's a different module bcrypto which hasn't been updated to work with m1 CPU. It does a bunch of assembly stuff from the looks of it.

It's a different module than bcrypt

Yeah i knew, but I thought the problem was similar, no idea how to fix it

@oynb-team
Copy link

I had a very similar error, but actually with bcrypt and not bcrypto. This thread appears very high on google, so here is what worked for me:

My problem was in node-gyp: https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md . I had to run these commands to check and reset the XCode path:

xcode-select -print-path
sudo xcode-select --reset
xcode-select -print-path

If the path changed, you know it needed the reset. I also had to also run xcodebuild -license to agree to the XCode license, but that's normal. After this I could build no problem (M1 Mac, Node 14.17, NPM 6.14, bcrypt 5.0.1).

I think I found this via https://medium.com/@mrjohnkilonzi/how-to-resolve-no-xcode-or-clt-version-detected-d0cf2b10a750

@Abdulmoiz-Ahmer
Copy link

Abdulmoiz-Ahmer commented Nov 5, 2021

I have the same issue even installing xcode command line tools didn't helped me.
I went with a fluke and installed Xcode IDE too but that didn't worked too.

yarn add bcrypt
yarn add v1.22.17
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning " > apollo-server-core@3.4.0" has incorrect peer dependency "graphql@^15.3.0".
warning "apollo-server-core > apollo-graphql@0.9.4" has incorrect peer dependency "graphql@^14.2.1 || ^15.0.0".
warning "apollo-server-core > apollo-server-errors@3.2.0" has incorrect peer dependency "graphql@^15.3.0".
warning "apollo-server-core > apollo-server-plugin-base@3.3.0" has incorrect peer dependency "graphql@^15.3.0".
warning "apollo-server-core > apollo-server-types@3.3.0" has incorrect peer dependency "graphql@^15.3.0".
warning "apollo-server-core > graphql-tag@2.12.5" has incorrect peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0".
warning " > apollo-server-express@3.4.0" has incorrect peer dependency "graphql@^15.3.0".
warning " > @typescript-eslint/eslint-plugin@5.3.0" has unmet peer dependency "@typescript-eslint/parser@^5.0.0".
warning " > eslint-config-standard-with-typescript@21.0.1" has incorrect peer dependency "@typescript-eslint/eslint-plugin@^4.0.1".
warning " > eslint-config-standard-with-typescript@21.0.1" has incorrect peer dependency "eslint@^7.12.1".
warning "eslint-config-standard-with-typescript > @typescript-eslint/parser@4.33.0" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0 || ^7.0.0".
warning "eslint-config-standard-with-typescript > eslint-config-standard@16.0.3" has incorrect peer dependency "eslint@^7.12.1".
warning " > eslint-plugin-promise@5.1.1" has incorrect peer dependency "eslint@^7.0.0".
[5/5] 🔨  Building fresh packages...
error /Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.6
node-pre-gyp info using node@16.13.0 | darwin | arm64
node-pre-gyp info check checked for "/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@16.13.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@8.2.0
gyp info using node@16.13.0 | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@8.2.0
gyp info using node@16.13.0 | darwin | arm64
gyp info find Python using Python version 3.8.2 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/abdulmoiz_ahmer/Library/Caches/node-gyp/16.13.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/abdulmoiz_ahmer/Library/Caches/node-gyp/16.13.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/abdulmoiz_ahmer/Library/Caches/node-gyp/16.13.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@8.2.0
gyp info using node@16.13.0 | darwin | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
clang: error: no such file or directory: 'Digital/Live'
clang: error: no such file or directory: 'Agents/in'
clang: error: no such file or directory: 'progres/live-agents-api/node_modules/node-addon-api'
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.4.0
gyp ERR! command "/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/bin/node" "/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt
gyp ERR! node -v v16.13.0
gyp ERR! node-gyp -v v8.2.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/bin/node /Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Darwin 20.4.0
node-pre-gyp ERR! command "/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/bin/node" "/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt
node-pre-gyp ERR! node -v v16.13.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.6
node-pre-gyp ERR! not ok 
Failed to execute '/Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/bin/node /Users/abdulmoiz_ahmer/.nvm/versions/node/v16.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/abdulmoiz_ahmer/workspace/Up Digital/Live Agents/in progres/live-agents-api/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)`

Any Idea about this?

@Abdulmoiz-Ahmer
Copy link

I had a very similar error, but actually with bcrypt and not bcrypto. This thread appears very high on google, so here is what worked for me:

My problem was in node-gyp: https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md . I had to run these commands to check and reset the XCode path:

xcode-select -print-path
sudo xcode-select --reset
xcode-select -print-path

If the path changed, you know it needed the reset. I also had to also run xcodebuild -license to agree to the XCode license, but that's normal. After this I could build no problem (M1 Mac, Node 14.17, NPM 6.14, bcrypt 5.0.1).

I think I found this via https://medium.com/@mrjohnkilonzi/how-to-resolve-no-xcode-or-clt-version-detected-d0cf2b10a750

This didn't work for me though.

@FanindhraThirunagaru
Copy link

FanindhraThirunagaru commented Nov 18, 2021

Unable to install bcrypt (5.0.1) on M1 Pro
Node: 17.0.1
OS: Monterey

npm ERR! path /Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm ERR!   LIBTOOL-STATIC Release/nothing.a
npm ERR!   CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
npm ERR! Failed to execute '/opt/homebrew/Cellar/node/17.0.1/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.7
npm ERR! node-pre-gyp info using node@17.0.1 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@17.0.1 (node-v102 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz 
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@17.0.1 | darwin | arm64
npm ERR! gyp info ok 
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@17.0.1 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.8 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/opt/homebrew/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   '/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/thirunagaru/Library/Caches/node-gyp/17.0.1/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=/Users/thirunagaru/Library/Caches/node-gyp/17.0.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/thirunagaru/Library/Caches/node-gyp/17.0.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt',
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! gyp info ok 
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@17.0.1 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! clang: error: no such file or directory: 'development'
npm ERR! clang: error: no such file or directory: 'course/Secrets/node_modules/node-addon-api'
npm ERR! make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 21.1.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/17.0.1/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt
npm ERR! gyp ERR! node -v v17.0.1
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node/17.0.1/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1062:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.1.0
npm ERR! node-pre-gyp ERR! command "/opt/homebrew/Cellar/node/17.0.1/bin/node" "/Users/thirunagaru/Desktop/web development course/Secrets/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/thirunagaru/Desktop/web development course/Secrets/node_modules/bcrypt
npm ERR! node-pre-gyp ERR! node -v v17.0.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.7
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/thirunagaru/.npm/_logs/2021-11-18T06_49_29_544Z-debug.log

@isaacewing
Copy link

@recrsn @Cucak if you guys send me a link with instructions, I'll download the source and compile it for a mac: amd64... i need it too but I can't figure out how to compile the source. don't send the link you pasted above, that thing doesn't tell anything about compiling on a mac and I can't find a makefile so that's the issue for me. send the instructions and I'll compile and create a pr today.

@Quentin-Guyot
Copy link

@recrsn @Cucak if you guys send me a link with instructions, I'll download the source and compile it for a mac: amd64... i need it too but I can't figure out how to compile the source. don't send the link you pasted above, that thing doesn't tell anything about compiling on a mac and I can't find a makefile so that's the issue for me. send the instructions and I'll compile and create a pr today.

I'm stuck as well with bcrypt on arm64...hope something will happen fast...

@santi-g-s
Copy link

Are you able to run make and g++?

Hi, I'm having this same issue. Could you explain how to 'compile from source' once I have python 3, Xcode installed and g++?

@isaacewing
Copy link

@QuentinGuyot-epitech @santi-g-s I gave up on waiting, they never sent me anything and I couldn't get it to work, I ended up using the JavaScript version of this library bcryptjs and it works fine. they also have TS support so I just removed this library.

@Cucak
Copy link
Author

Cucak commented Dec 7, 2021 via email

@Abdulmoiz-Ahmer
Copy link

@QuentinGuyot-epitech @santi-g-s I gave up on waiting, they never sent me anything and I couldn't get it to work, I ended up using the JavaScript version of this library bcryptjs and it works fine. they also have TS support so I just removed this library.

Yeah but that package hasn't been updated for a long while. Plus it's slower than this package.

@trykopa
Copy link

trykopa commented Dec 9, 2021

Hello guys, is any news about bcrypt image for M1 Mac ?

@TimurJiangShan
Copy link

Make sure you use the right version of node. something like that --platform=amd64 node:12-alpine rather than node:12-alpine

@joelcolucci
Copy link

joelcolucci commented Dec 24, 2021

Escaped characters in project directory path will break install on M1 machines

I am on a Mac OS Montery 12.0.1 with an M1 Pro Chip.

I encountered a similar error as above when running npm i bcrypt in a specific project directory.

I identified this error only occurred if a parent directory had an "&" or " " (seems like any escaped chars) in the path.

Failing install replication steps

  • Create a project with a directory with an ampersand or space in it
  • `mkdir "space in path"
  • Go into directory
  • cd space\ in\ path/
  • Run npm i bcrypt
  • Observe error

Successful install replication steps

  • Create a project directory without an ampersand or space
  • mkdir nospaceinpath
  • Go into directory
  • cd nospacewithpath
  • Run npm i bcrypt
  • Observe clean install

**There are likely other characters that will break the install

khalwat added a commit to nystudio107/vitejs-docker-dev that referenced this issue Dec 27, 2021
…om source for `arm64` (Apple Silicon M1) as [prebuilts don't exist](kelektiv/node.bcrypt.js#868)
@Quentin-Guyot
Copy link

As a workaround I finally use UTM to have a linux vm working on m1 then use docker inside it to run my project. No more error and all run as expected.

@joelcolucci
Copy link

@QuentinGuyot-epitech Does your project directory path contain escaped characters?

@verebes1
Copy link

Escaped characters in project directory path will break install on M1 machines

I am on a Mac OS Montery 12.0.1 with an M1 Pro Chip.

I encountered a similar error as above when running npm i bcrypt in a specific project directory.

I identified this error only occurred if a parent directory had an "&" or " " (seems like any escaped chars) in the path.

Failing install replication steps

* Create a project with a directory with an ampersand or space in it

* `mkdir "space in path"

* Go into directory

* `cd space\ in\ path/`

* Run `npm i bcrypt`

* Observe error

Successful install replication steps

* Create a project directory without an ampersand or space

* `mkdir nospaceinpath`

* Go into directory

* `cd nospacewithpath`

* Run `npm i bcrypt`

* Observe clean install

**There are likely other characters that will break the install

Can confirm @joelcolucci 's Solution is working perfectly. You need to make sure that your node project does not have any spaces or special characters in the path. I had -= in my path no spaces however but moving the project to a path with none of those characters helped. I think an update to the readme would be useful.

@vijayverma2003
Copy link

=> ERROR [dependencies 3/5] RUN npm install --production=false 14.4s

[dependencies 3/5] RUN npm install --production=false:
#12 13.35
#12 13.35 > bcrypt@5.0.1 install /usr/src/app/node_modules/bcrypt
#12 13.35 > node-pre-gyp install --fallback-to-build
#12 13.35
#12 13.72 node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-glibc.tar.gz
#12 13.72 node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@14.15.5 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
#12 13.72 node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-glibc.tar.gz
#12 13.86 gyp ERR! find Python
#12 13.86 gyp ERR! find Python Python is not set from command line or npm configuration
#12 13.86 gyp ERR! find Python Python is not set from environment variable PYTHON
#12 13.86 gyp ERR! find Python checking if "python" can be used
#12 13.86 gyp ERR! find Python - "python" is not in PATH or produced an error
#12 13.86 gyp ERR! find Python checking if "python2" can be used
#12 13.86 gyp ERR! find Python - "python2" is not in PATH or produced an error
#12 13.86 gyp ERR! find Python checking if "python3" can be used
#12 13.86 gyp ERR! find Python - "python3" is not in PATH or produced an error
#12 13.86 gyp ERR! find Python
#12 13.86 gyp ERR! find Python **********************************************************
#12 13.86 gyp ERR! find Python You need to install the latest version of Python.
#12 13.86 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#12 13.86 gyp ERR! find Python you can try one of the following options:
#12 13.86 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#12 13.86 gyp ERR! find Python (accepted by both node-gyp and npm)
#12 13.86 gyp ERR! find Python - Set the environment variable PYTHON
#12 13.86 gyp ERR! find Python - Set the npm configuration variable python:
#12 13.86 gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
#12 13.86 gyp ERR! find Python For more information consult the documentation at:
#12 13.86 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#12 13.86 gyp ERR! find Python **********************************************************
#12 13.86 gyp ERR! find Python
#12 13.86 gyp ERR! configure error
#12 13.86 gyp ERR! stack Error: Could not find any Python installation to use
#12 13.86 gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
#12 13.86 gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
#12 13.86 gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
#12 13.86 gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
#12 13.86 gyp ERR! stack at exithandler (child_process.js:315:5)
#12 13.86 gyp ERR! stack at ChildProcess.errorhandler (child_process.js:327:5)
#12 13.86 gyp ERR! stack at ChildProcess.emit (events.js:315:20)
#12 13.86 gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
#12 13.86 gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
#12 13.86 gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
#12 13.86 gyp ERR! System Linux 5.10.25-linuxkit
#12 13.86 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
#12 13.86 gyp ERR! cwd /usr/src/app/node_modules/bcrypt
#12 13.86 gyp ERR! node -v v14.15.5
#12 13.86 gyp ERR! node-gyp -v v5.1.0
#12 13.86 gyp ERR! not ok
#12 13.86 node-pre-gyp ERR! build error
#12 13.86 node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#12 13.86 node-pre-gyp ERR! stack at ChildProcess. (/usr/src/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#12 13.86 node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
#12 13.86 node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
#12 13.86 node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
#12 13.86 node-pre-gyp ERR! System Linux 5.10.25-linuxkit
#12 13.86 node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/src/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#12 13.86 node-pre-gyp ERR! cwd /usr/src/app/node_modules/bcrypt
#12 13.86 node-pre-gyp ERR! node -v v14.15.5
#12 13.86 node-pre-gyp ERR! node-pre-gyp -v v1.0.4
#12 13.86 node-pre-gyp ERR! not ok
#12 13.86 Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/src/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#12 14.17 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
#12 14.17 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#12 14.17
#12 14.24 npm ERR! code ELIFECYCLE
#12 14.24 npm ERR! errno 1
#12 14.24 npm ERR! bcrypt@5.0.1 install: node-pre-gyp install --fallback-to-build
#12 14.24 npm ERR! Exit status 1
#12 14.24 npm ERR!
#12 14.24 npm ERR! Failed at the bcrypt@5.0.1 install script.
#12 14.24 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I am using mac m1 and basically tried reinstalling whole my setup, I tried different node packages as well. I need to know if this package should not have problem with mac m1 cpu?

Do you find any solution?

@verebes1
Copy link

verebes1 commented Jan 12, 2022

@vijayverma-kvp Yes, the solution is that you need to check if your path to your project has any special characters like spaces or anything that would need to be escaped. In my case it was '=' character once I moved the project to a path where there are no spaces or special characters in the path it works perfectly fine.
I put a troubleshooting section here you can check it out

However in the case of the quoted answer check what is the return of running python --version if you have command not found then you need to look into adding python's path to your ~/.zshrc file or whatever env are you using.

@recrsn
Copy link
Collaborator

recrsn commented Jan 14, 2022

I got my hands on a m1 mac and now we have arm64 builds

@recrsn recrsn closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests