Unable to install bitcore

I have spent all day trying to install bitcore and I keep getting something like this at the end of the installation:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/jack/.nvm/versions/node/v4.2.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-67-generic
gyp ERR! command "/home/jack/.nvm/versions/node/v4.2.2/bin/node" "/home/jack/.nvm/versions/node/v4.2.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "--debug=false" "rebuild"
gyp ERR! cwd /home/jack/.nvm/versions/node/v4.2.2/lib/node_modules/bitcore/node_modules/bitcore-node
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Linux 3.13.0-67-generic
npm ERR! argv "/home/jack/.nvm/versions/node/v4.2.2/bin/node" "/home/jack/.nvm/versions/node/v4.2.2/bin/npm" "install" "-g" "bitcore"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! bitcore-node@1.0.0 install: `./bin/install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bitcore-node@1.0.0 install script './bin/install'.
npm ERR! This is most likely a problem with the bitcore-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./bin/install
npm ERR! You can get their info via:
npm ERR!     npm owner ls bitcore-node
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/jack/npm-debug.log

What should I do?

Where there any errors before this? When installing from npm or from a tagged release, gyp shouldn’t need to run as binaries are distributed.

Also please post bugs to https://github.com/bitpay/bitcore-node

If I just install using:

npm install bitcore

it completes the installation process but won’t let me run bitcore:

bitcored
- bash: bitcored: command not found

You can run ./bin/bitcored or install it globally with npm install -g bitcore.

Installing it globally is what has been problematic, I removed Gyp and now I’m getting this error:

prebuild: Permission denied

npm ERR! leveldown@1.4.2 install script 'prebuild --download'.
npm ERR! This is most likely a problem with the leveldown package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     prebuild --download

try:

npm install -g prebuild

most of this should be taken care of by npm…I am sort of guessing since I don’t know what your system looks like, but I’ve seen weird permissions be set on Mac OS X with some node modules. This is what I am referring to:

https://discussions.apple.com/thread/1202723?start=0&

Sorry if that is a red herring, but I was browsing through my node_modules (within bitcore) on a Mac and noticed that weird stuff.

I just installed prebuild and got the exact same error when trying to install bitcore. It’s Ubuntu 14.04 if that helps?

Are you using nvm to manage your different versions of node? If so, are you using sudo to install your node modules? If you are using nvm, what is the output of:

which node

let me know what the output of that is. Here’s the bottom line in this permissions stuff.

  1. install node using nvm, if possible [nvm script][1] and please don’t do that as root

  2. it would be a good idea to reset your permissions in your non-privileged users’ home directory .nvm directory as such:

    sudo chown -R whoami $HOME/.nvm

those are backticks around whoami

  1. I am really guessing as to what prebuild is referring to when it says “Permission denied”, but it might be referring to fact that it can’t read or write to ~/.npm/_prebuilds/ You might check the permissions on that. You should always have a ~/.npm directory, but maybe not yet a ~/.npm/_prebuilds/ directory

I hope you can get this thing going. It has been more than a few years since I wore my support hat. I am a bit rusty.
[1]: https://github.com/creationix/nvm