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

[FLI-933] PNPM node install errors #191

Closed
markphelps opened this issue Mar 26, 2024 · 4 comments
Closed

[FLI-933] PNPM node install errors #191

markphelps opened this issue Mar 26, 2024 · 4 comments
Milestone

Comments

@markphelps
Copy link
Contributor

markphelps commented Mar 26, 2024

From Discord: https://discord.com/channels/960634591000014878/1221907095377543238/1221907095377543238

On a M1 Mac but finding I'm unable to install the client sdk with pnpm install @flipt-io/flipt-client
I get a build issue from ffi-napi relating to node-gyp

../[email protected]/node_modules/ffi-napi install$ node-gyp-build
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | 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 
 ...
│ 3 errors generated.
│ make: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1
│ gyp ERR! build error
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack     at ChildProcess.onExit (/Users/user1/.asdf/installs/pnpm/8.15.4/dist/node_modules/node-gyp/lib/build.js:203:23)
│ gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
│ gyp ERR! System Darwin 23.2.0
│ gyp ERR! command "/Users/user1/.asdf/installs/nodejs/21.6.1/bin/node" "/Users/user1/.asdf/installs/pnpm/8.15.4/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
│ gyp ERR! cwd /Users/user1/dev/dev/proj/node_modules/.pnpm/[email protected]/node_modules/ffi-napi
│ gyp ERR! node -v v21.6.1
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok
└─ Failed in 2.1s at /Users/user1/dev/proj/node_modules/.pnpm/[email protected]/node_modules/ffi-napi
 ELIFECYCLE  Command failed with exit code 1.

FLI-933

@markphelps markphelps changed the title PNPM node install errors [FLI-933] PNPM node install errors Mar 26, 2024
@markphelps
Copy link
Contributor Author

We're seeing this in CI now: https://github.com/flipt-io/flipt-client-sdks/actions/runs/8437274323/job/23106705698#step:5:1343

I wonder if some version of node or the headers linked above got revoked?

@markphelps
Copy link
Contributor Author

ah or maybe its a node 21 issue: node-ffi-napi/node-ffi-napi#267

I can install it fine on my M1 Mac but I'm using node 18.19.0

» pnpm install @flipt-io/flipt-client
Packages: +17
+++++++++++++++++
Downloading registry.npmjs.org/@flipt-io/flipt-client/0.4.3: 15.66 MB/15.66 MB, done
Progress: resolved 17, reused 3, downloaded 14, added 17, done
node_modules/.pnpm/[email protected]/node_modules/ref-napi: Running install script, done in 2.6s
node_modules/.pnpm/[email protected]/node_modules/ffi-napi: Running install script, done in 3.3s

dependencies:
+ @flipt-io/flipt-client 0.4.3

Done in 7.4s

@markphelps
Copy link
Contributor Author

Yeah. It didnt work on node 21.. Likely due to the issue linked above

Can you try downgrading to node 20?

Progress: resolved 17, reused 17, downloaded 0, added 17, done
node_modules/.pnpm/[email protected]/node_modules/ref-napi: Running install script, done in 2.9s
node_modules/.pnpm/[email protected]/node_modules/ffi-napi: Running install script, failed in 1.9s
.../[email protected]/node_modules/ffi-napi install$ node-gyp-build
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | arm64
│ gyp info find Python using Python version 3.11.3 found at "/Users/markphelps/.pyenv/versions/3.11.3/bin/python3"
│ gyp info spawn /Users/markphelps/.pyenv/versions/3.11.3/bin/python3
│ gyp info spawn args [
│ gyp info spawn args   '/Users/markphelps/.asdf/installs/nodejs/21.6.1/lib/node_modules/pnpm/dist/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   '/private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/ffi-napi/build/config.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/markphelps/.asdf/installs/nodejs/21.6.1/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/markphelps/Library/Caches/node-gyp/21.6.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/markphelps/Library/Caches/node-gyp/21.6.1',
│ gyp info spawn args   '-Dnode_gyp_dir=/Users/markphelps/.asdf/installs/nodejs/21.6.1/lib/node_modules/pnpm/dist/node_modules/node-gyp',
│ gyp info spawn args   '-Dnode_lib_file=/Users/markphelps/Library/Caches/node-gyp/21.6.1/<(target_arch)/node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=/private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/ffi-napi',
│ 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/nothing/../../../[email protected]/node_modules/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)
│   CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
│   CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
│   CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
│   CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
│ ../deps/libffi/src/java_raw_api.c:328:46: warning: 'ffi_java_raw_size' is deprecated [-Wdeprecated-declarations]
│   ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
│                                              ^
│ ../deps/libffi/config/mac/arm64/ffi.h:299:56: note: 'ffi_java_raw_size' has been explicitly marked deprecated here
│ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
│                                                        ^
│ ../deps/libffi/src/java_raw_api.c:331:3: warning: 'ffi_java_ptrarray_to_raw' is deprecated [-Wdeprecated-declarations]
│   ffi_java_ptrarray_to_raw (cif, avalue, raw);
│   ^
│ ../deps/libffi/config/mac/arm64/ffi.h:295:93: note: 'ffi_java_ptrarray_to_raw' has been explicitly marked deprecated here
│ void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
│                                                                                             ^
│ 2 warnings generated.
│   CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
│   CC(target) Release/obj.target/ffi/deps/libffi/src/aarch64/ffi.o
│ ../deps/libffi/src/aarch64/ffi.c:738:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
│       if (i + 1 == cif->aarch64_nfixedargs)
│           ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
│ ../deps/libffi/src/aarch64/ffi.c:991:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
│       if (i + 1 == cif->aarch64_nfixedargs)
│           ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
│ 2 warnings generated.
│   CC(target) Release/obj.target/ffi/deps/libffi/src/aarch64/sysv.o
│   LIBTOOL-STATIC Release/libffi.a
│   CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
│ In file included from ../src/ffi.cc:5:
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/get-uv-event-loop-napi-h/include/get-uv-event-loop-napi.h:26:30: error: incompatible function pointer types assigning to 'get_uv_event_loop_fn' (aka 'napi_…
│   napi_get_uv_event_loop__ = &napi_get_uv_event_loop;
│                              ^~~~~~~~~~~~~~~~~~~~~~~
│ In file included from ../src/ffi.cc:3:
│ In file included from ../src/ffi.h:2:
│ In file included from /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2725:
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
│   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
│            ^~~~~~~~~~~~~~~~~~
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<Napi::Value (*)(…
│     status = Napi::details::AttachData(env, *result, data);
│                             ^
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<Napi::Value (*)(const…
│   napi_status status = CreateFunction(env,
│                        ^
│ ../src/ffi.cc:58:38: note: in instantiation of function template specialization 'Napi::Function::New<Napi::Value (*)(const Napi::CallbackInfo &)>' requested here
│   target["ffi_prep_cif"] = Function::New(env, FFIPrepCif);
│                                      ^
│ /Users/markphelps/Library/Caches/node-gyp/21.6.1/include/node/js_native_api.h:513:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_nogc_finalize'…
│ napi_add_finalizer(napi_env env,
│ ^
│ In file included from ../src/ffi.cc:3:
│ In file included from ../src/ffi.h:2:
│ In file included from /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2725:
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
│   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
│            ^~~~~~~~~~~~~~~~~~
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<void (*)(const N…
│     status = Napi::details::AttachData(env, *result, data);
│                             ^
│ /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<void (*)(const Napi::…
│   napi_status status = CreateFunction(env,
│                        ^
│ ../src/ffi.cc:60:34: note: in instantiation of function template specialization 'Napi::Function::New<void (*)(const Napi::CallbackInfo &)>' requested here
│   target["ffi_call"] = Function::New(env, FFICall);
│                                  ^
│ /Users/markphelps/Library/Caches/node-gyp/21.6.1/include/node/js_native_api.h:513:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_nogc_finalize'…
│ napi_add_finalizer(napi_env env,
│ ^
│ 3 errors generated.
│ make: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1
│ gyp ERR! build error 
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack     at ChildProcess.onExit (/Users/markphelps/.asdf/installs/nodejs/21.6.1/lib/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:203:23)
│ gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
│ gyp ERR! System Darwin 23.2.0
│ gyp ERR! command "/Users/markphelps/.asdf/installs/nodejs/21.6.1/bin/node" "/Users/markphelps/.asdf/installs/nodejs/21.6.1/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
│ gyp ERR! cwd /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/ffi-napi
│ gyp ERR! node -v v21.6.1
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok 
└─ Failed in 1.9s at /private/tmp/gosdk/node_modules/.pnpm/[email protected]/node_modules/ffi-napi
 ELIFECYCLE  Command failed with exit code 1.

@markphelps
Copy link
Contributor Author

Downgrading to node 20 seems to fix the issue. Closing for now. Created #200 for alternatives

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

No branches or pull requests

1 participant