trufflesuite / drizzle

Reactive Ethereum dapp UI suite
906 stars 235 forks source link

Resolve errors when trying to use drizzle-react package alongside drizzle #96

Open graham-u opened 4 years ago

graham-u commented 4 years ago

I followed this guide: https://www.trufflesuite.com/docs/drizzle/quickstart

...which went fine then proceeded to the linked drizzle-react guide here https://github.com/trufflesuite/drizzle/tree/master/packages/react-plugin

But the line: import {DrizzleContext} from "drizzle-react";

Causes this error in my dev environment: error - ./node_modules/drizzle-react/dist/drizzle-react.js Module not found: Can't resolve 'drizzle' in '/home/*/projects/personal****/node_modules/drizzle-react/dist'

So to me it looks like drizzle-react is looking for drizzle incorrectly or in the wrong place?

The https://www.trufflesuite.com/docs/drizzle/quickstart tutorial has me using npm install --save @drizzle/store to get drizzle, but I think I saw the earlier way was npm install drizzle, but I saw on an issue that this is outdated and it also gave me errors as follows:

yarn add drizzle    
yarn add v1.15.2
[1/4] Resolving packages...
warning drizzle > web3 > web3-bzz > swarm-js > fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
warning drizzle > web3 > web3-bzz > swarm-js > tar.gz@1.0.7: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
warning drizzle > eth-block-tracker-es5 > json-rpc-engine > babel-preset-env > babel-plugin-check-es2015-constants > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning drizzle > eth-block-tracker-es5 > json-rpc-engine > babelify > babel-core > babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/6] ⠁ waiting...
[-/6] ⠁ waiting...
[-/6] ⠁ waiting...
[4/6] ⠁ scrypt
error /home/********/projects/personal/*************/node_modules/scrypt: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /home/********/projects/personal/*************/node_modules/scrypt
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.0
gyp info using node@13.14.0 | linux | x64
gyp info find Python using Python version 2.7.12 found at "/usr/bin/python"
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/********/projects/personal/*************/node_modules/scrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/********/.cache/node-gyp/13.14.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/********/.cache/node-gyp/13.14.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/********/.cache/node-gyp/13.14.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/********/projects/personal/*************/node_modules/scrypt',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/********/projects/personal/*************/node_modules/scrypt/build'
  SOLINK_MODULE(target) Release/obj.target/copied_files.node
  COPY Release/copied_files.node
  CC(target) Release/obj.target/scrypt_wrapper/src/util/memlimit.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/keyderivation.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/pickparams.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/hash.o
  AR(target) Release/obj.target/scrypt_wrapper.a
  COPY Release/scrypt_wrapper.a
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/warnp.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/alg/sha256.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/insecure_memzero.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o
  AR(target) Release/obj.target/scrypt_lib.a
  COPY Release/scrypt_lib.a
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o
In file included from ../src/node-boilerplate/inc/scrypt_async.h:28:0,
                 from ../src/node-boilerplate/inc/scrypt_params_async.h:28,
                 from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_common.h: In constructor ‘NodeScrypt::Params::Params(const v8::Local<v8::Object>&)’:
../src/node-boilerplate/inc/scrypt_common.h:39:48: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>)’
       N(obj->Get(Nan::New("N").ToLocalChecked())->Uint32Value()),
                                                ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3594:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3594:43: note:   candidate expects 2 arguments, 1 provided
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3597:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3597:43: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/node-boilerplate/inc/scrypt_async.h:28:0,
                 from ../src/node-boilerplate/inc/scrypt_params_async.h:28,
                 from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_common.h:40:48: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>)’
       r(obj->Get(Nan::New("r").ToLocalChecked())->Uint32Value()),
                                                ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3594:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3594:43: note:   candidate expects 2 arguments, 1 provided
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3597:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3597:43: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/node-boilerplate/inc/scrypt_async.h:28:0,
                 from ../src/node-boilerplate/inc/scrypt_params_async.h:28,
                 from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_common.h:41:48: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>)’
       p(obj->Get(Nan::New("p").ToLocalChecked())->Uint32Value()) {}
                                                ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3594:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3594:43: note:   candidate expects 2 arguments, 1 provided
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3597:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3597:43: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/node-boilerplate/inc/scrypt_params_async.h:28:0,
                 from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_async.h: In member function ‘virtual void ScryptAsyncWorker::HandleErrorCallback()’:
../src/node-boilerplate/inc/scrypt_async.h:53:29: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
       callback->Call(1, argv);
                             ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:1:0:
../../nan/nan.h:1742:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:0:
../src/node-boilerplate/inc/scrypt_params_async.h: In constructor ‘ScryptParamsAsyncWorker::ScryptParamsAsyncWorker(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/node-boilerplate/inc/scrypt_params_async.h:35:36: error: no matching function for call to ‘v8::Value::NumberValue()’
       maxtime(info[0]->NumberValue()),
                                    ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2773:39: note: candidate: v8::Maybe<double> v8::Value::NumberValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
                                       ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2773:39: note:   candidate expects 1 argument, 0 provided
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:0:
../src/node-boilerplate/inc/scrypt_params_async.h:36:39: error: no matching function for call to ‘v8::Value::NumberValue()’
       maxmemfrac(info[1]->NumberValue()),
                                       ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2773:39: note: candidate: v8::Maybe<double> v8::Value::NumberValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
                                       ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2773:39: note:   candidate expects 1 argument, 0 provided
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:0:
../src/node-boilerplate/inc/scrypt_params_async.h:37:36: error: no matching function for call to ‘v8::Value::IntegerValue()’
       maxmem(info[2]->IntegerValue()),
                                    ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2774:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                        ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2774:40: note:   candidate expects 1 argument, 0 provided
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:0:
../src/node-boilerplate/inc/scrypt_params_async.h:38:39: error: no matching function for call to ‘v8::Value::IntegerValue()’
       osfreemem(info[3]->IntegerValue())
                                       ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2774:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                        ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:2774:40: note:   candidate expects 1 argument, 0 provided
../src/node-boilerplate/scrypt_params_async.cc: In member function ‘virtual void ScryptParamsAsyncWorker::HandleOKCallback()’:
../src/node-boilerplate/scrypt_params_async.cc:23:67: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
   obj->Set(Nan::New("N").ToLocalChecked(), Nan::New<Integer>(logN));
                                                                   ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                     ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
../src/node-boilerplate/scrypt_params_async.cc:24:64: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
   obj->Set(Nan::New("r").ToLocalChecked(), Nan::New<Integer>(r));
                                                                ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                     ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
../src/node-boilerplate/scrypt_params_async.cc:25:64: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
   obj->Set(Nan::New("p").ToLocalChecked(), Nan::New<Integer>(p));
                                                                ^
In file included from /home/********/.cache/node-gyp/13.14.0/include/node/node.h:67:0,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                     ^
/home/********/.cache/node-gyp/13.14.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
../src/node-boilerplate/scrypt_params_async.cc:32:25: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
   callback->Call(2, argv);
                         ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:1:0:
../../nan/nan.h:1742:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^
scrypt.target.mk:131: recipe for target 'Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o' failed
make: Leaving directory '/home/********/projects/personal/*************/node_modules/scrypt/build'
make: *** [Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.15.0-101-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/********/projects/personal/*************/node_modules/scrypt

Could anyone advise how to get set up? I only need drizzle and drizzle-react working I believe.

Thanks

pjot726 commented 4 years ago

Hello @grahamutton, Have you installed a blockchain package such as ganache-cli or parity?

blakewest commented 4 years ago

I'm having the same issue. I am using Buidler EVM as my local blockchain, which seems generally compatible with all other tools I've been using (ie. Truffle, web3, etc.)

I can also confirm that using ganache-cli results in the same error. And it's not clear why a blockchain package would result in this error, as it looks like some kind of import issue. Any thoughts?

cds-amal commented 4 years ago

@grahamutton Sorry for the late response. The documentation is not up to date with the example code. The monorepo's example projects is the most updated testing/working reference.

SalahAdDin commented 4 years ago

@cds-amal Yeah, it is also with hooks.