JankoDedic / poker.js

Texas Hold 'Em Poker table model with convenience features for running real games.
MIT License
14 stars 7 forks source link

Failed build on Macos #1

Open itka4yk opened 4 years ago

itka4yk commented 4 years ago

Hello

Poker.js installation is failed on my macos env. I have installed new gcc and clang.

But when I try to run

yarn add poker

I have the following error.

error /Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker: Command failed.
Exit code: 1
Command: npx node-gyp configure && npx node-gyp build
Arguments:
Directory: /Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@12.4.0 | darwin | x64
gyp info find Python using Python version 2.7.10 found at "/usr/bin/python"
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args   '/Users/6998/Desktop/repos/poker24/packages/api/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/6998/Desktop/repos/poker24/packages/api/node_modules/poker/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/6998/Library/Caches/node-gyp/12.4.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/6998/Library/Caches/node-gyp/12.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/6998/Library/Caches/node-gyp/12.4.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker',
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@5.0.5
gyp info using node@12.4.0 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/addon/src/addon.o
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:60:3: error: cannot use 'try' with exceptions disabled
  try {
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:275:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(*this, status, Object());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:282:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(*this, status, Value());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:289:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(*this, status, Value());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:335:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:354:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, napi_undefined);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:397:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:408:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:419:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:438:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:449:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:460:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:476:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, Boolean());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:483:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, Number());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:490:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, String());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:497:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, Object());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:508:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(env, status, Boolean());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:525:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(_env, status, false);
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
In file included from ../src/addon.cc:1:
In file included from /Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:2051:
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi-inl.h:536:3: error: cannot use 'throw' with exceptions disabled
  NAPI_THROW_IF_FAILED(env, status, Number());
  ^
/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-addon-api/napi.h:54:28: note: expanded from macro 'NAPI_THROW_IF_FAILED'
  if ((status) != napi_ok) throw Napi::Error::New(env);
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/addon/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/6998/Desktop/repos/poker24/packages/api/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/6998/.nvm/versions/node/v12.4.0/bin/node" "/Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker/node_modules/.bin/node-gyp" "build"
gyp ERR! cwd /Users/6998/Desktop/repos/poker24/packages/api/node_modules/poker
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v5.0.5

I've also tried to run installation with env set, for example

env CC=/usr/local/opt/llvm\@7/bin/clang CXX=/usr/local/opt/llvm\@7/bin/clang++ yarn add poker
# OR
env CC=gcc-8 CXX=g++-8 yarn add poker

Env:

  1. MacOS - 10.14.6
  2. Node - 12.4.0
sharathprabhal commented 4 years ago

@itka4yk were you able to get around this?

itka4yk commented 4 years ago

@sharathprabhal yeah, for development I've used ubuntu in docker container with some preparations:

FROM ubuntu

RUN apt-get update
RUN apt-get install build-essential gcc-8 g++-8 clang-7 make curl gnupg -y

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt update
RUN apt-get install yarn nodejs -y

...
prasad-yashdeep commented 2 years ago

getting the issue . Unable to find a work around please help

claudijo commented 2 years ago

I ported this poker library to Node.js some time ago (thanks @JankoDedic for the well written source). If anyone coming here is interested, check out https://www.npmjs.com/package/poker-ts