hsd icon indicating copy to clipboard operation
hsd copied to clipboard

nodejs v15 is NOT supported

Open 0xtoko opened this issue 3 years ago • 13 comments

I can't seem to run hsd on mac. Already ran npm install and also reinstalled leveldown but no luck. Any suggestions?

Followed instructions from: https://handshake.org/claim/

OS: Mac Big Sur (11.2.2) [email protected] [email protected]

takuma@MacBook-Pro hsd % ./bin/hsd --log-level info
/Users/takuma/Documents/vscode Projects/handshake/hsd-2.3.0/hsd/node_modules/loady/lib/loady.js:156
  throw err;
  ^

Error: Cannot find module 'leveldown.node'
    at moduleError (/Users/takuma/Documents/vscode Projects/handshake/hsd-2.3.0/hsd/node_modules/loady/lib/loady.js:154:15)
    at resolve (/Users/takuma/Documents/vscode Projects/handshake/hsd-2.3.0/hsd/node_modules/loady/lib/loady.js:89:9)
    at load (/Users/takuma/Documents/vscode Projects/handshake/hsd-2.3.0/hsd/node_modules/loady/lib/loady.js:99:16)
    at Object.<anonymous> (/Users/takuma/Documents/vscode Projects/handshake/hsd-2.3.0/hsd/node_modules/bdb/lib/level.js:9:33)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18) {
  code: 'MODULE_NOT_FOUND'
}

0xtoko avatar Mar 16 '21 15:03 0xtoko

You might have to stick with node 14 -- what was the output of npm install ?

pinheadmz avatar Mar 16 '21 15:03 pinheadmz

No errors. Will try downgrading node.

takuma@MacBook-Pro hsd % npm install

up to date, audited 47 packages in 2s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

0xtoko avatar Mar 16 '21 16:03 0xtoko

also try npm rebuild -- it should compile levelDB (written in C++) and produce the leveldown.node file that appears missing

pinheadmz avatar Mar 16 '21 16:03 pinheadmz

downgrading node to 14.16.0 and running npm install and npm rebuild did the trick! Thanks.

0xtoko avatar Mar 16 '21 16:03 0xtoko

Good to know, thanks. Closing for now... we'll have to address new versions of node eventually.

pinheadmz avatar Mar 16 '21 16:03 pinheadmz

I had this same problem on hsd v2.4 with node v14.17.0. I fixed it by going into a few node_modules and running node-gyp configure && node-gyp build. The modules were bdb, bcrypto, goosig, mrmr.

Hope this helps others experiencing this issue

lyoshenka avatar Jun 08 '21 20:06 lyoshenka

@lyoshenka you would have to rebuild after switching nodejs versions - was this your case?

I'm going to reopen this and pin it as a FAQ.

pinheadmz avatar Jun 09 '21 13:06 pinheadmz

rebuild did not help, but I now understand what happened: i have post-install scripts disabled (because of this) so node-gyp is never called and never builds the .node files.

lyoshenka avatar Jun 09 '21 14:06 lyoshenka

@lyoshenka 's approach worked for me with Node16.7.0. I had to install unbound dev package, then I ran something like:

cd node_modules
for gyp in $(ls */binding.gyp)
do
  dir=${gyp%binding.gyp}
  cd $dir && node-gyp configure && node-gyp && cd -
done

nkoehring avatar Sep 07 '21 12:09 nkoehring

Thanks @nkoehring I'm also looking into an issue on Big Sur with the new Apple M1 chip. Homebrew installs libraries like unbound in a new location /opt/homebrew and I'm not sure how to handle this yet. My system was migrated from an older Mac so I still have the Intel-compiled unbound in /usr/local, node-gyp seems to find it ok there and is able to link. However users who are installing hsd on a brand new computer with the latest version of homebrew might have an issue linking to unbound in the new location.

pinheadmz avatar Sep 07 '21 16:09 pinheadmz

@nkoehring 's technique worked for me on an Intel Mac running macOS Monterey, except I had to have the second node-gyp be nod-gyp build and I had to ensure that the libtool being used was the one from xtools / builtin to macOS and not gnu libtools from homebrew.

export PATH=/usr/bin:$PATH # Ensure the builtin  libtool was used
cd node_modules
for gyp in $(ls */binding.gyp)
do
  dir=${gyp%binding.gyp}
  cd $dir && node-gyp configure && node-gyp build && cd - # Added build as the argument to the second node-gyp
done

rberger avatar Nov 28 '21 03:11 rberger

Worked for me too.

bitcoinbrisbane avatar Sep 27 '22 06:09 bitcoinbrisbane

Can we upgrade this ticket to Node 16.x?

bitcoinbrisbane avatar Oct 05 '22 23:10 bitcoinbrisbane