Closed scriptzteam closed 8 years ago
I haven't seen this before, but it shouldn't be necessary to have prebuild installed, there may be an issue here.
I'm getting the same issue. Is there a solution?
I've seen this before. I recommend that you use a non-privileged user instead of root when using npm/nodejs/nvm for bitcore. I haven't duplicated this problem myself, so please excuse the lack of details about why prebuild can't be found. I would not want to use root to install bitcore for security reasons.
I just realized that although the correct solution is to run bitcore as a non-privileged user, we aren't really making it easy for bitcore users that use their system's installation of node.js. Most distros that I've checked ship or install an ancient version of node.js (0.6 on Ubuntu/Debian is an example). So, if you aren't using node version manager, it might be more difficult to perform: sudo npm install -g bitcore. I do see a reference to nvm in the above logs so this good. You can simply:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash $ . ~/.bashrc $ nvm install v4 $ nvm install -g bitcore
To run insight-api and insight-ui on port 80 or other privileged ports, simply run insight on a port greater than 1024 such as 3001 and configure iptables route from priv port to port 3001:
For the folks that want to use their late-model node.js from their distro (which is a good idea for updates and tracking from their distro), I will keep this issue open and investigate this prebuild stuff.
I'm not using nvm though so what do I do? I went back and deleted node so that i could install it as a non-privileged user. I then tried to run the install command again but I got the same error. Should I install nvm and use that to install bitcore?
For those not using nvm, I recommend the following:
Continue to use only a non-privileged user. Then:
$ sudo npm cache clean
this should allow node and npm to know where the prebuild script lives (which is <usually /usr/local/lib>/node_modules/bitcore/node_modules/leveldown/node_modules/.bin)
there is only one project that is absolutely needs prebuild in order to make bitcore run; that is leveldown. Node and npm should install the prebuild npm module dependency, which installs a script in .bin in the node_modules directory and then add that path to its PATH.
I am going to upgrade my 15.04 machine to 15.10 and test this out shortly.
Just did:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash $ . ~/.bashrc $ nvm install v4 $ nvm install -g bitcore
Version 'bitcore' not found - try nvm ls-remote
to browse available versions.
[sudo] password for bitcore: bitcore is not in the sudoers file. This incident will be reported.
Here is what I tested and the results:
$ sudo npm cache clean -f
this assumes that this user in the sudoers file. If not, then add it to sudoers -or- do this: $ su - then you won't need sudo in front of the rest of the following commands
$ sudo npm install -g n
this installs the 'n' package that helps upgrade node itself
$ sudo n 4.2.3
this installs node 4.2.3
$ sudo ln -sf /usr/local/n/versions/node/4.2.3/bin/node /usr/bin/node
symlinks 4.2.3 version of node to a likely first position of the PATH env variable. You can check this by:
$ which node
should be /usr/local/bin
$ node -v
should be 4.2.3
$ sudo npm install -g bitcore
node this is npm and not nvm
if you still get the sh: prebuild command not found. Then try adding the ".bin" directory temporarily to your path to see if this clears things up
$ PATH=$PATH:/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/node_modules/leveldown/node_modules/.bin
that is the path that prebuild is.
Sorry about the prebuild stuff. Bitcoin uses leveldb and Bitcore uses leveldown on top of leveldb. Leveldown uses prebuild to deliver a binary to save people from needing a compiler toolchain.
ok i'm not getting the "prebuild command not found" instead i'm getting
prebuild ERR! build EACCES: permission denied, mkdir '/root/.node-gyp' npm WARN optional dep failed, continuing utf-8-validate@1.2.1 npm WARN optional dep failed, continuing bufferutil@1.2.1 npm ERR! Linux 2.6.32-573.8.1.el6.x86_64 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "bitcore" npm ERR! node v4.2.3 npm ERR! npm v2.14.7 npm ERR! code ELIFECYCLE
npm ERR! leveldown@1.4.3 install: prebuild --download
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the leveldown@1.4.3 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
npm ERR! You can get their info via:
npm ERR! npm owner ls leveldown
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! /root/npm-debug.log
BitCore wrks great now ;) also insight-ui works (https://github.com/bitpay/bitcore/issues/1376#issuecomment-165765043)
sudo npm cache clean -f
sudo npm cache clean -f
sudo npm install -g n /usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
sudo n 4.2.3
install : node-v4.2.3
mkdir : /usr/local/n/versions/node/4.2.3
fetch : https://nodejs.org/dist/v4.2.3/node-v4.2.3-linux-x64.tar.gz
which node
node -v
sudo npm install -g bitcore
Unpacking binary distribution build/Release/bitcoind.node build/Release/bitcoind.node.sig /usr/local/bin/bitcore -> /usr/local/lib/node_modules/bitcore/bin/bitcore /usr/local/bin/bitcored -> /usr/local/lib/node_modules/bitcore/bin/bitcored bitcore@2.0.0 /usr/local/lib/node_modules/bitcore ├── insight-ui@0.3.0 ├── bitcore-lib@0.13.11 (buffer-compare@1.0.0, inherits@2.0.1, bs58@2.0.0, bn.js@2.0.4, sha512@0.0.1, elliptic@3.0.3, lodash@3.10.1) ├── insight-api@0.3.1 (async@1.5.0, bitcore-message@1.0.2, lodash@2.4.2, request@2.67.0)
sudo npm install -g bitcore-node
prebuild WARN install EACCES: permission denied, open '/root/.npm/_prebuilds/https-github.com-bitpay-bufferutil-releases-download-v1.2.1-bufferutil-v1.2.1-node-v46-linux-x64.tar.gz.13227-3708aa1c.tmp' prebuild ERR! build EACCES: permission denied, mkdir '/root/.node-gyp/4.2.3' npm WARN optional dep failed, continuing utf-8-validate@1.2.1
leveldown@1.4.3 install /usr/local/lib/node_modules/bitcore-node/node_modules/leveldown prebuild --download
Unpacking binary distribution build/Release/bitcoind.node build/Release/bitcoind.node.sig bitcore-node@1.0.1 /usr/local/lib/node_modules/bitcore-node ├── bindings@1.2.1 ├── async@1.5.0 ├── semver@5.1.0 ├── colors@1.1.2 ├── commander@2.9.0 (graceful-readlink@1.0.1) ├── errno@0.1.4 (prr@0.0.0) ├── nan@2.1.0 ├── mkdirp@0.5.0 (minimist@0.0.8) ├── body-parser@1.14.2 (content-type@1.0.1, bytes@2.2.0, depd@1.1.0, qs@5.2.0, on-finished@2.3.0, raw-body@2.1.5, http-errors@1.3.1, debug@2.2.0, iconv-lite@0.4.13, type-is@1.6.10) ├── express@4.13.3 (escape-html@1.0.2, merge-descriptors@1.0.0, cookie@0.1.3, array-flatten@1.1.1, cookie-signature@1.0.6, utils-merge@1.0.0, content-type@1.0.1, methods@1.1.1, vary@1.0.1, content-disposition@0.5.0, fresh@0.3.0, path-to-regexp@0.1.7, etag@1.7.0, range-parser@1.0.3, serve-static@1.10.0, parseurl@1.3.0, depd@1.0.1, qs@4.0.0, on-finished@2.3.0, finalhandler@0.4.0, debug@2.2.0, proxy-addr@1.0.10, send@0.13.0, accepts@1.2.13, type-is@1.6.10) ├── memdown@1.1.0 (inherits@2.0.1, ltgt@1.0.2, functional-red-black-tree@1.0.1, abstract-leveldown@2.4.1) ├── levelup@1.3.1 (level-errors@1.0.4, prr@1.0.1, xtend@4.0.1, level-codec@6.1.0, deferred-leveldown@1.2.1, level-iterator-stream@1.3.1) ├── liftoff@2.2.0 (extend@2.0.1, rechoir@0.6.2, flagged-respawn@0.3.1, resolve@1.1.6, findup-sync@0.3.0) ├── bitcore-lib@0.13.11 (buffer-compare@1.0.0, inherits@2.0.1, bs58@2.0.0, bn.js@2.0.4, sha512@0.0.1, elliptic@3.0.3, lodash@3.10.1) ├── npm@2.14.15 ├── socket.io-client@1.3.7 (to-array@0.1.3, component-emitter@1.2.0, indexof@0.0.1, component-bind@1.0.0, backo2@1.0.2, object-component@0.0.3, has-binary@0.1.6, debug@2.1.3, parseuri@0.0.2, socket.io-parser@2.2.4, engine.io-client@1.5.4) ├── leveldown@1.4.3 (fast-future@1.0.1, abstract-leveldown@2.4.1, prebuild@2.7.1) └── socket.io@1.3.7 (has-binary@0.1.6, debug@2.1.3, socket.io-adapter@0.4.0, socket.io-parser@2.2.4, engine.io@1.5.4, socket.io-client@1.3.7)
bitcore-node create mynode
Unpacking binary distribution build/Release/bitcoind.node build/Release/bitcoind.node.sig bitcore-lib@0.13.11 node_modules/bitcore-lib ├── inherits@2.0.1 ├── buffer-compare@1.0.0 ├── bs58@2.0.0 ├── bn.js@2.0.4 ├── sha512@0.0.1 ├── elliptic@3.0.3 (brorand@1.0.5, hash.js@1.0.3) └── lodash@3.10.1
bitcore-node@1.0.1 node_modules/bitcore-node ├── bindings@1.2.1 ├── async@1.5.0 ├── semver@5.1.0 ├── colors@1.1.2 ├── commander@2.9.0 (graceful-readlink@1.0.1) ├── errno@0.1.4 (prr@0.0.0) ├── nan@2.1.0 ├── mkdirp@0.5.0 (minimist@0.0.8) ├── body-parser@1.14.2 (content-type@1.0.1, bytes@2.2.0, depd@1.1.0, qs@5.2.0, on-finished@2.3.0, raw-body@2.1.5, http-errors@1.3.1, debug@2.2.0, iconv-lite@0.4.13, type-is@1.6.10) ├── express@4.13.3 (escape-html@1.0.2, merge-descriptors@1.0.0, array-flatten@1.1.1, cookie@0.1.3, cookie-signature@1.0.6, utils-merge@1.0.0, content-type@1.0.1, vary@1.0.1, methods@1.1.1, content-disposition@0.5.0, fresh@0.3.0, etag@1.7.0, range-parser@1.0.3, serve-static@1.10.0, path-to-regexp@0.1.7, parseurl@1.3.0, depd@1.0.1, qs@4.0.0, on-finished@2.3.0, finalhandler@0.4.0, debug@2.2.0, proxy-addr@1.0.10, type-is@1.6.10, send@0.13.0, accepts@1.2.13) ├── memdown@1.1.0 (inherits@2.0.1, ltgt@1.0.2, functional-red-black-tree@1.0.1, abstract-leveldown@2.4.1) ├── liftoff@2.2.0 (extend@2.0.1, rechoir@0.6.2, flagged-respawn@0.3.1, resolve@1.1.6, findup-sync@0.3.0) ├── levelup@1.3.1 (level-errors@1.0.4, prr@1.0.1, xtend@4.0.1, level-codec@6.1.0, deferred-leveldown@1.2.1, level-iterator-stream@1.3.1) ├── npm@2.14.15 ├── socket.io@1.3.7 (has-binary@0.1.6, debug@2.1.3, socket.io-parser@2.2.4, socket.io-adapter@0.4.0, socket.io-client@1.3.7, engine.io@1.5.4) ├── leveldown@1.4.3 (fast-future@1.0.1, abstract-leveldown@2.4.1, prebuild@2.7.1) └── socket.io-client@1.3.7 (to-array@0.1.3, component-emitter@1.2.0, indexof@0.0.1, component-bind@1.0.0, backo2@1.0.2, object-component@0.0.3, debug@2.1.3, has-binary@0.1.6, parseuri@0.0.2, socket.io-parser@2.2.4, engine.io-client@1.5.4)
bitcore-node install insight-api
insight-api@0.3.1 node_modules/insight-api ├── async@1.5.0 ├── bitcore-message@1.0.2 ├── lodash@2.4.2 └── request@2.67.0 (aws-sign2@0.6.0, forever-agent@0.6.1, tunnel-agent@0.4.2, oauth-sign@0.8.0, form-data@1.0.0-rc3, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.2.1, node-uuid@1.4.7, qs@5.2.0, combined-stream@1.0.5, mime-types@2.1.8, hawk@3.1.2, http-signature@1.1.0, bl@1.0.0, har-validator@2.0.3)
bitcore-node install insight-ui
insight-ui@0.3.0 node_modules/insight-ui
bitcore-node start
[2015-12-18T11:42:38.193Z] info: Starting bitcoind [2015-12-18T11:42:39.216Z] info: Bitcoin Daemon Ready [2015-12-18T11:42:39.216Z] info: Starting db [2015-12-18T11:42:39.356Z] info: Bitcoin Database Ready [2015-12-18T11:42:39.357Z] info: Starting address [2015-12-18T11:42:39.453Z] info: Starting web
bitcore install insight-api insight-ui insight-api@0.3.1 node_modules/insight-api ├── async@1.5.0 ├── bitcore-message@1.0.2 ├── lodash@2.4.2 └── request@2.67.0 (aws-sign2@0.6.0, forever-agent@0.6.1, tunnel-agent@0.4.2, oauth-sign@0.8.0, form-data@1.0.0-rc3, caseless@0.11.0, is-typedarray@1.0.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.2.1, node-uuid@1.4.7, qs@5.2.0, combined-stream@1.0.5, mime-types@2.1.8, hawk@3.1.2, bl@1.0.0, http-signature@1.1.0, har-validator@2.0.3)
/root/mynode/node_modules/bitcore-lib/lib/util/preconditions.js:9
throw new errors.InvalidState(message);
^
Invalid state: undefined
Error
at Error.NodeError (/root/mynode/node_modules/bitcore-lib/lib/errors/index.js:20:41)
at Object.module.exports.checkState (/root/mynode/node_modules/bitcore-lib/lib/util/preconditions.js:9:13)
at /root/mynode/node_modules/bitcore-node/lib/scaffold/add.js:106:11
at ChildProcess.
Okay after playing with it a bit i got it FINALLLLYYY works :D
root@:~/mynode# ls
root@:~/mynode# vi bitcore-node.json { "datadir": "/home/bitcoin", "network": "livenet", "port": 3001, "services": [ "address", "bitcoind", "db", "insight-api", "insight-ui", "web" ]
root@:~/mynode# bitcore-node start [2015-12-18T12:05:25.708Z] info: Starting bitcoind [2015-12-18T12:05:35.005Z] info: Bitcoin Daemon Ready [2015-12-18T12:05:35.005Z] info: Starting db [2015-12-18T12:05:35.116Z] info: Bitcoin Database Ready [2015-12-18T12:05:35.116Z] info: Starting address [2015-12-18T12:05:35.352Z] info: Starting web [2015-12-18T12:05:35.386Z] info: Starting insight-api [2015-12-18T12:05:35.387Z] info: Starting insight-ui [2015-12-18T12:05:35.388Z] info: Bitcore Node ready
:)
@scriptzteam did you have to upgrade python to 2.7.* to get it to work? I am running on centos 6 so i had to update python for node-gyp. but now npm says it cannot locate the python2.7 executable. I didn't think there were executables in linux but that what the error says. my path is correct i'm using /usr/local/bin/python2.7 but its giving me the same error. should i try to update gcc as well?
but you are on centos, i am on ubuntu 15.10, maybe thats why you have still errors
Python 2.7.10
i did no upgrade on python just did all these commands to get it work https://github.com/bitpay/bitcore/issues/1376#issuecomment-165761559
@scriptzteam ok. i have updated python, set up the bitcore superuser, cleaned my cache (several times) and tried to run the install at least 30-40 times and i keep getting a build error "Make failed with exit code 2". Is there anything else you did to get the installation to run to completion? I am truely lost right now. It isn't even telling me where the real error is. here is my latest console output:
make: *\ [Release/obj.target/leveldown/src/batch.o] Error 1
make: Leaving directory /usr/local/lib/node_modules/bitcore/node_modules/leveldown/build' prebuild ERR! build error prebuild ERR! stack Error:
makefailed with exit code: 2 prebuild ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/bitcore/node_modules/node-gyp/lib/build.js:276:23) prebuild ERR! stack at emitTwo (events.js:87:13) prebuild ERR! stack at ChildProcess.emit (events.js:172:7) prebuild ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) prebuild ERR! not ok prebuild ERR! build Error:
make` failed with exit code: 2
prebuild ERR! build at ChildProcess.onExit (/usr/local/lib/node_modules/bitcore/node_modules/node-gyp/lib/build.js:276:23)
prebuild ERR! build at emitTwo (events.js:87:13)
prebuild ERR! build at ChildProcess.emit (events.js:172:7)
prebuild ERR! build at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
/usr/local/lib
└── (empty)
npm ERR! Linux 2.6.32-573.12.1.el6.x86_64 npm ERR! argv "/usr/local/bin/node" "/usr/bin/npm" "install" "-g" "bitcore" npm ERR! node v4.2.3 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE
npm ERR! leveldown@1.4.3 install: prebuild --download
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the leveldown@1.4.3 install script 'prebuild --download'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs leveldown
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls leveldown
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! /root/npm-debug.log npm ERR! code 1
Just these all commands --> apt-get install npm sudo npm cache clean -f sudo npm install -g n sudo n 4.2.3 sudo npm install -g bitcore sudo npm install -g bitcore-node bitcore-node create mynode cd mynode bitcore-node install insight-api bitcore-node install insight-ui bitcore-node start
what version of gcc/g++ are you running? @scriptzteam
Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.2.1-22ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2)
hello, please, everytime i try to open my javascript file from my desktop, it says error 'bitcore-lib'not found, please help me
root@root:~# npm install -g bitcore \
sh: prebuild: command not found
sh: prebuild: command not found
sh: prebuild: command not found npm WARN optional dep failed, continuing utf-8-validate@1.2.1
sh: prebuild: command not found npm WARN optional dep failed, continuing utf-8-validate@1.2.1
sh: prebuild: command not found npm WARN optional dep failed, continuing bufferutil@1.2.1
sh: prebuild: command not found npm WARN optional dep failed, continuing bufferutil@1.2.1
sh: prebuild: command not found npm WARN optional dep failed, continuing utf-8-validate@1.2.1 npm WARN optional dep failed, continuing bufferutil@1.2.1 npm ERR! Linux 3.14.32-xxxx-grs-ipv6-64 npm ERR! argv "/root/.nvm/versions/node/v4.2.3/bin/node" "/root/.nvm/versions/node/v4.2.3/bin/npm" "install" "-g" "bitcore" npm ERR! node v4.2.3 npm ERR! npm v2.14.7 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn
npm ERR! leveldown@1.4.2 install:
prebuild --download
npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the 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 npm ERR! You can get their info via: npm ERR! npm owner ls leveldown npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! /root/npm-debug.log