Installing Dat using NPM

526 Views Asked by At

While installing Dat on my MacBook Pro, I saw the following. While I was able to successfully clone a dat after this install, I'm wondering if some of the functionality may still be compromised due to some of the errors that follow below. Any advice on how to get around these install issues? I started with a clean install of Node via Homebrew prior to executing this npm install command.

MacBook-Pro-5:doc cpd$ npm install -g dat
/usr/local/Cellar/node/12.6.0/bin/dat -> /usr/local/Cellar/node/12.6.0/lib/node_modules/dat/bin/cli.js

> [email protected] install /usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/fd-lock
> node-gyp-build


> [email protected] install /usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/sodium-native
> node-gyp-build "node preinstall.js" "node postinstall.js"

autoconf is required, but wasn't found on this system
./configure: line 5: ./configure: No such file or directory
/usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/sodium-native/preinstall.js:119
    if (err) throw err
             ^

Error: ./configure exited with 127
    at ChildProcess.<anonymous> (/usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/sodium-native/preinstall.js:149:25)
    at ChildProcess.emit (events.js:203:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

> [email protected] install /usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/discovery-swarm/node_modules/utp-native
> node-gyp-build

  CXX(target) Release/obj.target/libutp/deps/libutp/utp_internal.o
../deps/libutp/utp_internal.cpp:1970:34: warning: comparison of integers of different signs: 'int' and
      'uint32' (aka 'unsigned int') [-Wsign-compare]
                if (conn->mtu_probe_seq && seq == conn->mtu_probe_seq) {
                                           ~~~ ^  ~~~~~~~~~~~~~~~~~~~
../deps/libutp/utp_internal.cpp:156:19: warning: unused variable 'flagnames' [-Wunused-const-variable]
static const cstr flagnames[] = {
                  ^
../deps/libutp/utp_internal.cpp:174:19: warning: unused variable 'statenames' [-Wunused-const-variable]
static const cstr statenames[] = {
                  ^
3 warnings generated.
  CXX(target) Release/obj.target/libutp/deps/libutp/utp_utils.o
  CXX(target) Release/obj.target/libutp/deps/libutp/utp_hash.o
  CXX(target) Release/obj.target/libutp/deps/libutp/utp_callbacks.o
  CXX(target) Release/obj.target/libutp/deps/libutp/utp_api.o
  CXX(target) Release/obj.target/libutp/deps/libutp/utp_packedsockaddr.o
  LIBTOOL-STATIC Release/utp.a
  CXX(target) Release/obj.target/utp/src/utp_uv.o
../src/utp_uv.cc:219:1: warning: unused function 'on_utp_schedule_ack' [-Wunused-function]
on_utp_schedule_ack (utp_callback_arguments *a) {
^
1 warning generated.
  CXX(target) Release/obj.target/utp/src/socket_wrap.o
../src/socket_wrap.cc:69:23: warning: 'Call' is deprecated [-Wdeprecated-declarations]
      this->on_drain->Call(ctx, 0, NULL);
                      ^
../../../../nan/nan.h:1717:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../../../nan/nan.h:104:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/socket_wrap.cc:99:36: error: no matching member function for call to 'ToObject'
  Local<Object> context = info[0]->ToObject();
                          ~~~~~~~~~^~~~~~~~
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:2532:44: note: candidate function not viable: requires single
      argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:2546:31: note: candidate function not viable: requires single
      argument 'isolate', but no arguments were provided
                Local<Object> ToObject(Isolate* isolate) const);
                              ^
../src/socket_wrap.cc:113:34: error: no matching member function for call to 'ToObject'
  Local<Value> buffer = info[0]->ToObject();
                        ~~~~~~~~~^~~~~~~~
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:2532:44: note: candidate function not viable: requires single
      argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:2546:31: note: candidate function not viable: requires single
      argument 'isolate', but no arguments were provided
                Local<Object> ToObject(Isolate* isolate) const);
                              ^
../src/socket_wrap.cc:141:52: error: no matching member function for call to 'ToObject'
    Local<Value> buffer = Nan::Get(writes->Get(i)->ToObject(), chunk).ToLocalChecked();
                                   ~~~~~~~~~~~~~~~~^~~~~~~~
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:2532:44: note: candidate function not viable: requires single
      argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:2546:31: note: candidate function not viable: requires single
      argument 'isolate', but no arguments were provided
                Local<Object> ToObject(Isolate* isolate) const);
                              ^
../src/socket_wrap.cc:141:44: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
    Local<Value> buffer = Nan::Get(writes->Get(i)->ToObject(), chunk).ToLocalChecked();
                                           ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:3416:3: note: 'Get' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index));
  ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8config.h:326:29: note: expanded from macro 'V8_DEPRECATE_SOON'
  declarator __attribute__((deprecated(message)))
                            ^
../src/socket_wrap.cc:243:62: error: too few arguments to function call, single argument 'context' was not
      specified
  instance = Nan::NewInstance(constructorHandle->GetFunction()).ToLocalChecked();
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8.h:5948:3: note: 'GetFunction' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
  ^
/Users/cpd/.node-gyp/12.6.0/include/node/v8config.h:351:31: note: expanded from macro
      'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
2 warnings and 4 errors generated.
make: *** [Release/obj.target/utp/src/socket_wrap.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/12.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/discovery-swarm/node_modules/utp-native
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> [email protected] install /usr/local/Cellar/node/12.6.0/lib/node_modules/dat/node_modules/utp-native
> node-gyp-build

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/dat/node_modules/sodium-native):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp-build "node preinstall.js" "node postinstall.js"`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/dat/node_modules/discovery-swarm/node_modules/utp-native):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
added 473 packages from 245 contributors in 32.968s
2

There are 2 best solutions below

1
On

Libsodium hasn't been updated to support Node 12 yet. (There were significant changes to the interfaces which is causing this to take longer than usual.) Issue is filed here: https://github.com/datproject/dat/issues/1110

0
On

You need autoconf installed on your system to build native module for dat.

Install autoconf with-

brew install autoconf

Then run again-

npm install -g dat