bitcore-node
bitcore-node copied to clipboard
`install` subcommand allows installation of non-bitcore-node services
I erroneously executed bitcore-node install insight (see bitpay/insight#698) instead of bitcore-node install insight-ui. :disappointed: This caused startup failures with my node:
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight /opt/insight/lib/node_modules/bitcore-node/lib/scaffold/start.js:64
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight throw new Error(
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight ^
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight Error: Could not load service "insight" as it does not support necessary methods.
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Function.setupServices (/opt/insight/lib/node_modules/bitcore-node/lib/scaffold/start.js:64:15)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at start (/opt/insight/lib/node_modules/bitcore-node/lib/scaffold/start.js:203:31)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Command.<anonymous> (/opt/insight/lib/node_modules/bitcore-node/lib/cli/main.js:69:7)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Command.listener (/opt/insight/lib/node_modules/bitcore-node/node_modules/commander/index.js:301:8)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at emitTwo (events.js:87:13)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Command.emit (events.js:172:7)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Command.parseArgs (/opt/insight/lib/node_modules/bitcore-node/node_modules/commander/index.js:615:12)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Command.parse (/opt/insight/lib/node_modules/bitcore-node/node_modules/commander/index.js:458:21)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Object.main (/opt/insight/lib/node_modules/bitcore-node/lib/cli/main.js:145:11)
2015-12-01T02:10:15+00:00 a2f86ba48e5e [info] insight at Liftoff.<anonymous> (/opt/insight/lib/node_modules/bitcore-node/lib/cli/bitcore.js:31:16)
It might be nice if the install subcommand could verify that the service specified was actually a bitcore-node service (and not some arbitrary module) before modifying bitcore-node.json.
It turns out the best way to determine such as to try to load it once it's installed.