janoside / btc-rpc-explorer

Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
https://bitcoinexplorer.org
MIT License
1.5k stars 1.11k forks source link

macos install issue #448

Closed 11100010 closed 2 years ago

11100010 commented 2 years ago

macos: 12.0.1 bitcoin core ver: 22.0.0 node -v 14.15.5 npm -v 6.14.11

MacBook-Pro bitcoin % npm install -g btc-rpc-explorer npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/xxxxx/.npm/_logs/2022-05-31T02_20_21_107Z-debug.log

jsarenik commented 2 years ago

Do you have HomeBrew installed already and running fine under this user?

The issue is that npm is unable to write to /usr/local/lib/node_modules. Installing brew should supposedly fix that (no macos here, but remember the times; now a native Linux running on top of Mac Book hardware).

11100010 commented 2 years ago

Yea, my homebrew still running well under this user. -MacBook-Pro cs50 % brew -v Homebrew 3.4.11 Homebrew/homebrew-core (git revision 830f43e6e65; last commit 2022-06-01)

jsarenik commented 2 years ago

So try to manually make the missieng directory:

mkdir /usr/local/lib/node

Then please try to install again.

Additional question: How was node installed? (e.g. from HomeBrew or nvm)

11100010 commented 2 years ago

I've tried to use sudo to install and this was the result:

l1100100@11100100s-MacBook-Pro ~ % sudo mkdir /usr/local/lib/node Password: l1100100@11100100s-MacBook-Pro ~ % sudo npm install -g btc-rpc-explorer /usr/local/bin/btc-rpc-explorer -> /usr/local/lib/node_modules/btc-rpc-explorer/bin/cli.js

dtrace-provider@0.8.8 install /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/dtrace-provider node-gyp rebuild || node suppress-error.js

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/l1100100/Library/Caches/node-gyp/14.15.5" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/btc-rpc-explorer/node_modules/dtrace-provider/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/btc-rpc-explorer/node_modules/dtrace-provider/.node-gyp' gyp ERR! System Darwin 21.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/dtrace-provider gyp ERR! node -v v14.15.5 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok

tiny-secp256k1@1.1.6 install /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/tiny-secp256k1 npm run build || echo "secp256k1 bindings compilation fail. Pure JS implementation will be used."

tiny-secp256k1@1.1.6 build /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/tiny-secp256k1 node-gyp rebuild

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/l1100100/Library/Caches/node-gyp/14.15.5" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/btc-rpc-explorer/node_modules/tiny-secp256k1/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/btc-rpc-explorer/node_modules/tiny-secp256k1/.node-gyp' gyp ERR! System Darwin 21.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/tiny-secp256k1 gyp ERR! node -v v14.15.5 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! tiny-secp256k1@1.1.6 build: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the tiny-secp256k1@1.1.6 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. secp256k1 bindings compilation fail. Pure JS implementation will be used.

event-loop-stats@1.3.0 install /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/event-loop-stats node-gyp rebuild

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/l1100100/Library/Caches/node-gyp/14.15.5" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/btc-rpc-explorer/node_modules/event-loop-stats/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/btc-rpc-explorer/node_modules/event-loop-stats/.node-gyp' gyp ERR! System Darwin 21.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/btc-rpc-explorer/node_modules/event-loop-stats gyp ERR! node -v v14.15.5 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: event-loop-stats@1.3.0 (node_modules/btc-rpc-explorer/node_modules/event-loop-stats): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: event-loop-stats@1.3.0 install: node-gyp rebuild npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

11100010 commented 2 years ago

I don't remember how my node was installed, is it's version too old causing the problem?

11100010 commented 2 years ago

My MacOS is the latest version now 12.4

jsarenik commented 2 years ago

All /usr/local should be owned by your user. Sudo will mess it up. As far as I remember brew should give some sane advice on not using it with sudo.

To restore the ownership of all in /usr/local to your current user:

sudo chown -R $WHOAMI /usr/local

Then try to install again. No sudo.

11100010 commented 2 years ago

Does this mean the install was successful?

l1100100@11100100s-MacBook-Pro ~ % npm install -g btc-rpc-explorer npm WARN config global --global, --local are deprecated. Use --location=global instead. npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 371 packages, and audited 372 packages in 14s

23 packages are looking for funding run npm fund for details

6 vulnerabilities (2 moderate, 3 high, 1 critical)

To address issues that do not require attention, run: npm audit fix

To address all issues possible (including breaking changes), run: npm audit fix --force

Some issues need review, and may require choosing a different dependency.

Run npm audit for details. npm notice npm notice New minor version of npm available! 8.11.0 -> 8.12.1 npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.12.1 npm notice Run npm install -g npm@8.12.1 to update! npm notice

11100010 commented 2 years ago

Last login: Mon Jun 6 01:07:46 on ttys000 ➜ ~ btc-rpc-explorer btcexp:app Searching for config files... +0ms btcexp:app Config file found at /Users/l1100100/.config/btc-rpc-explorer.env, loading... +0ms btcexp:app Config file not found at /etc/btc-rpc-explorer/.env, continuing... +1ms btcexp:app Config file not found at /Users/l1100100/.env, continuing... +0ms btcexp:app Default cacheId '3.3.0' +967ms btcexp:app Enabling view caching (performance will be improved but template edits will not be reflected) +376ms btcexp:app Environment(development) - Node: v18.3.0, Platform: darwin, Versions: {"node":"18.3.0","v8":"10.2.154.4-node.8","uv":"1.44.1","zlib":"1.2.11","brotli":"1.0.9","ares":"1.18.1","modules":"108","nghttp2":"1.47.0","napi":"8","llhttp":"6.0.6","openssl":"1.1.1o","cldr":"40.0","icu":"70.1","tz":"2021a3","unicode":"14.0"} +11ms btcexp:app No sourcecode version available, continuing to use default cacheId '3.3.0' +1ms btcexp:app Starting BTC RPC Explorer, v3.3.0 at http://127.0.0.1:3002/ +0ms btcexp:app Connecting to RPC node at 127.0.0.1:8332 +0ms btcexp:app Verifying RPC connection... +6ms btcexp:app Loading mining pools config +1ms btcexp:error Error RpcError-001: Error: no auth mechanism defined, json: {"userData":{"request":"getnetworkinfo"}}, userData: [object Object] (json: {"request":"getnetworkinfo"}) +0ms btcexp:error Error RpcError-001: Error: no auth mechanism defined, json: {"userData":{"request":"getblockchaininfo"}}, userData: [object Object] (json: {"request":"getblockchaininfo"}) +2ms btcexp:error Error 32ugegdfsde: Error: no auth mechanism defined, json: {"userData":{"request":"getnetworkinfo"}}, userData: [object Object] (json: {}) +0ms

I think I made it very close, thank you for your support very much.