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

Cannot install node unit on macos #960

Closed
haikyuu opened this issue Sep 26, 2023 · 2 comments
Closed

Cannot install node unit on macos #960

haikyuu opened this issue Sep 26, 2023 · 2 comments

Comments

@haikyuu
Copy link

haikyuu commented Sep 26, 2023

I folllow the instructions on Macos, but I cannot install nodejs module.
I get the same error as in the issue but since I'm on Mac, I can't apt install unit-dev ...

npm install -g --unsafe-perm unit-http

npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/unit-http
npm ERR! command failed
npm ERR! command sh -c node-gyp configure build
npm ERR! CXX(target) Release/obj.target/unit-http/unit.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.1
npm ERR! gyp info using node@18.17.1 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.5 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/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   '/usr/local/lib/node_modules/unit-http/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/abdellah/Library/Caches/node-gyp/18.17.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/abdellah/Library/Caches/node-gyp/18.17.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/abdellah/Library/Caches/node-gyp/18.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/unit-http',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../unit.cpp:6:
npm ERR! In file included from ../unit.h:9:
npm ERR! ../nxt_napi.h:17:10: fatal error: 'nxt_unit.h' file not found
npm ERR! #include <nxt_unit.h>
npm ERR!          ^~~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/unit-http/unit.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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/unit-http
npm ERR! gyp ERR! node -v v18.17.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/empty-cache/_logs/2023-09-26T06_56_29_218Z-debug-0.log

How do I using nginx unit with nodejs in Macos?

@haikyuu
Copy link
Author

haikyuu commented Sep 26, 2023

closing as duplicate of #395

@haikyuu haikyuu closed this as completed Sep 26, 2023
@thresheek
Copy link
Member

You can install unit from homebrew, through brew install unit, and then (for the current release 1.31.0):
CXXFLAGS="-I/opt/homebrew/Cellar/unit/1.31.0/include/" LDFLAGS="-L/opt/homebrew/Cellar/unit/1.31.0/lib" npm install unit-http will build it just fine.

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

2 participants