Compiling on Windows produces compilation errors for the installed @openzeppelin/contracts-ethereum-package/contracts

This has got to be something stupid but I’ve Googled everything I can think of.

Using the starter kit tutorial using the following commands (as instructed)
npm install ganache-cli@6.7.0
npx @openzeppelin/cli unpack tutorial
ganache-cli --deterministic
npx openzeppelin init
npx openzeppelin compile

Expected a clean compilation but the compilation returns a lot of file not found errors like
× Compiling contracts with solc 0.5.16 (commit.9c3226ce)
Compilation errors:
@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol:5:1: ParserError: Source “@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol” not found: File import callback not supported
import “…/GSN/Context.sol”;
^--------------------------^

:computer: Environment
Windows 10 Command Prompt – everything else downloaded as above

:memo:Details
Not sure what else I can include. It’s just command prompt instructions. What could I be missing?

:1234: Code to reproduce
No code other than the two contracts installed by the tutorial. If I remove them, there are no contracts to compile and the error disappears. If I removetheir imports, the same thing happens (obviously).

1 Like

The files that can’t be found are correctly present in the node modules directory with the correct path starting with the @openzeppelin. Is there maybe some path that I’m not setting somehow/somewhere?

1 Like

Hi @MWaser,

Welcome to the community :wave:

Sorry to hear you are having issues. What version of node (node —version) are you running? Do you have Windows Build Tools installed?

You may want to look at using Windows Subsystem for Linux. This is what I use on Windows 10 rather than running natively and run into far fewer issues.

The following topic gives the two options for development on Windows:

Thank you for responding!

So . . . . here is more data . . . .

Starting with a totally fresh install of Node 12.14.1-x64
C:>npm install -g @openzeppelin/cli
runs and completes with no errors

C:> mkdir oz
C:> cd oz
C:\oz> openzeppelin unpack tutorial
runs and completes with no errors

C:\oz> ganache-cli --deterministic
C:\oz> openzeppelin init
C:\oz> openzeppelin compile
produces the file not found errors

================================
NOW FOR THE INTERESTING PARTS

  1. fresh node install (being sure to remove chocolatey)
    C:>npm install -g @openzeppelin/cli
    C:>npm uninstall -g @openzeppelin/cli
    C:>npm install -g @openzeppelin/cli

produces various errors related to
keccak@1.4.0 rebuild: node-gyp rebuild

  1. fresh node install (again being sure to remove chocolatey)
    npx @openzeppelin/cli unpack tutorial
    produces various errors related to
    keccak@1.4.0 rebuild: node-gyp rebuild
    but completes

again,
C:\oz> ganache-cli --deterministic
C:\oz> openzeppelin init
C:\oz> openzeppelin compile
produces the file not found errors

========================================================================
So . . . . I’ve got two problems:

  1. The original compilation errors
  2. openzeppelin/cli apparently trashes my node installation

========================================================================
I’m now going to take your advice and switch to the Windows Subsystem for Linux and will report back on my results

Thanks again!

So now I am very sad. I have switched to using WSL2 per the link above and still have Keccak errors.

They are, however different errors (appear more like compilation errors) – so maybe you can help. Do I possible have a bad version of some tool?

mwaser@DESKTOP-AUSCT6L:/mnt/c/oz$ node -v
v12.14.1
mwaser@DESKTOP-AUSCT6L:/mnt/c/oz$ npm -v
6.13.4

mwaser@DESKTOP-AUSCT6L:/mnt/c/oz$ npx @openzeppelin/cli unpack tutorial
…/src/privatekey.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE privateKeyNegate(Nan::NAN_METHOD_ARGS_TYPE)’:
…/src/privatekey.cc:73:30: warning: ignoring return value of ‘int secp256k1_ec_privkey_negate(const secp256k1_context*, unsigned char*)’, declared with attribute warn_unused_result [-Wunused-result]
secp256k1_ec_privkey_negate(secp256k1ctx, &private_key[0]);

../src/ecdsa.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE sign(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ecdsa.cc:88:131: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
fo.GetIsolate()->GetCurrentContext(), Nan::New<v8::String>("signature").ToLocalChecked(), COPY_BUFFER(&output[0], 64));
                                                                                                                   ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/ecdsa.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:3408:37: note: declared here
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^~~
../src/ecdsa.cc:89:130: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
nfo.GetIsolate()->GetCurrentContext(), Nan::New<v8::String>("recovery").ToLocalChecked(), Nan::New<v8::Number>(recid));
                                                                                                                   ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/ecdsa.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:3408:37: note: declared here
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^~~
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::Initialize(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:37:47: error: no matching function for call to ‘v8::Value::IntegerValue()’
  unsigned int rate = info[0]->IntegerValue();
                                            ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/addon.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                     ^~~~~~~~~~~~
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc:38:51: error: no matching function for call to ‘v8::Value::IntegerValue()’
  unsigned int capacity = info[1]->IntegerValue();
                                                ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/addon.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                     ^~~~~~~~~~~~
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::AbsorbLastFewBits(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:56:48: error: no matching function for call to ‘v8::Value::IntegerValue()’
  unsigned char bits = info[0]->IntegerValue();
                                             ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/addon.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                     ^~~~~~~~~~~~
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::Squeeze(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:64:43: error: no matching function for call to ‘v8::Value::IntegerValue()’
  size_t length = info[0]->IntegerValue();
                                        ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/addon.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                     ^~~~~~~~~~~~
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::Copy(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:75:82: error: no matching function for call to ‘v8::Value::ToObject()’
  KeccakWrapper* to = Nan::ObjectWrap::Unwrap<KeccakWrapper>(info[0]->ToObject());
                                                                               ^
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
              from ../src/addon.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2576:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const
V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                         ^~~~~~~~
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2576:44: note:   candidate expects 1 argument, 0 provided
In file included from /home/mwaser/.cache/node-gyp/12.14.1/include/node/v8-internal.h:14:0,
              from /home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:25,
              from /home/mwaser/.cache/node-gyp/12.14.1/include/node/node.h:63,
              from ../src/addon.cc:1:
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2590:31: note: candidate: v8::Local<v8::Object> v8::Value::ToObject(v8::Isolate*) const
              Local<Object> ToObject(Isolate* isolate) const);
                            ^
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8.h:2590:31: note:   candidate expects 1 argument, 0 provided
              Local<Object> ToObject(Isolate* isolate) const);
                            ^
/home/mwaser/.cache/node-gyp/12.14.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
make: *** [Release/obj.target/keccak/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/mwaser/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.84-microsoft-standard
gyp ERR! command "/home/mwaser/.nvm/versions/node/v12.14.1/bin/node" "/home/mwaser/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/mwaser/.npm/_npx/18613/lib/node_modules/@openzeppelin/cli/node_modules/solc-wrapper/node_modules/keccak
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@1.4.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mwaser/.npm/_logs/2020-02-05T21_29_19_014Z-debug.log
Downloading kit from https://github.com/openzeppelin/tutorial-kit.git
1 Like

Hi @MWaser,

I’m sorry that you still had an issue when using WSL2.

I changed to node 12 and just unpacked the tutorial using @openzeppelin/cli unpack tutorial and get the same error as you, though my understanding is that it then uses a pure JS implementation of the dependency. I logged today that this error is displayed when installing the CLI:
https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1371#issuecomment-582701916

Once the tutorial is unpacked, we can initialize our project with OpenZeppelin

$ npx oz init app

Create the contract on our local testnet (after running ganache-cli -d in a separate terminal)

$ npx oz create
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate Counter
? Pick a network development
✓ Added contract Counter
✓ Contract Counter deployed
All contracts have been deployed
? Call a function to initialize the instance after creating it? Yes
? Select which function * initialize(num: uint256)
? num (uint256): 23
✓ Setting everything up to create contract instances
✓ Instance created at 0xCfEB869F69431e42cdB54A4F4f105C19C080A601
0xCfEB869F69431e42cdB54A4F4f105C19C080A601

Start the client

$ cd client
$ npm run start

View the Counter dapp in the browser http://localhost:3000/counter

Alternatively, I generally use node 10.

This was the error I was shown when unpacking the tutorial:

$ npx @openzeppelin/cli unpack tutorial
../src/privatekey.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE privateKeyNegate(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/privatekey.cc:73:30: warning: ignoring return value of ‘int secp256k1_ec_privkey_negate(const secp256k1_context*, unsigned char*)’, declared with attribute warn_unused_result [-Wunused-result]
   secp256k1_ec_privkey_negate(secp256k1ctx, &private_key[0]);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/ecdsa.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE sign(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ecdsa.cc:88:131: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
 fo.GetIsolate()->GetCurrentContext(), Nan::New<v8::String>("signature").ToLocalChecked(), COPY_BUFFER(&output[0], 64));
                                                                                                                      ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/ecdsa.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:3408:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^~~
../src/ecdsa.cc:89:130: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result]
 nfo.GetIsolate()->GetCurrentContext(), Nan::New<v8::String>("recovery").ToLocalChecked(), Nan::New<v8::Number>(recid));
                                                                                                                      ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/ecdsa.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:3408:37: note: declared here
   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                     ^~~
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::Initialize(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:37:47: error: no matching function for call to ‘v8::Value::IntegerValue()’
     unsigned int rate = info[0]->IntegerValue();
                                               ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                        ^~~~~~~~~~~~
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc:38:51: error: no matching function for call to ‘v8::Value::IntegerValue()’
     unsigned int capacity = info[1]->IntegerValue();
                                                   ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                        ^~~~~~~~~~~~
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::AbsorbLastFewBits(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:56:48: error: no matching function for call to ‘v8::Value::IntegerValue()’
     unsigned char bits = info[0]->IntegerValue();
                                                ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                        ^~~~~~~~~~~~
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::Squeeze(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:64:43: error: no matching function for call to ‘v8::Value::IntegerValue()’
     size_t length = info[0]->IntegerValue();
                                           ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
                                        ^~~~~~~~~~~~
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note:   candidate expects 1 argument, 0 provided
../src/addon.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE KeccakWrapper::Copy(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cc:75:82: error: no matching function for call to ‘v8::Value::ToObject()’
     KeccakWrapper* to = Nan::ObjectWrap::Unwrap<KeccakWrapper>(info[0]->ToObject());
                                                                                  ^
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63:0,
                 from ../src/addon.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2576:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                            ^~~~~~~~
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2576:44: note:   candidate expects 1 argument, 0 provided
In file included from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8-internal.h:14:0,
                 from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:25,
                 from /home/abcoathup/.cache/node-gyp/12.14.1/include/node/node.h:63,
                 from ../src/addon.cc:1:
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2590:31: note: candidate: v8::Local<v8::Object> v8::Value::ToObject(v8::Isolate*) const
                 Local<Object> ToObject(Isolate* isolate) const);
                               ^
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8.h:2590:31: note:   candidate expects 1 argument, 0 provided
                 Local<Object> ToObject(Isolate* isolate) const);
                               ^
/home/abcoathup/.cache/node-gyp/12.14.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
make: *** [Release/obj.target/keccak/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/abcoathup/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.4.0-18362-Microsoft
gyp ERR! command "/home/abcoathup/.nvm/versions/node/v12.14.1/bin/node" "/home/abcoathup/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/abcoathup/.npm/_npx/3973/lib/node_modules/@openzeppelin/cli/node_modules/solc-wrapper/node_modules/keccak
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@1.4.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/abcoathup/.npm/_logs/2020-02-06T04_03_19_762Z-debug.log
✓ Kit downloaded and unpacked
The kit is ready to use.

Quick Start
Run your local blockchain:
> ganache-cli --deterministic
Initialize the OpenZeppelin SDK project:
> openzeppelin init app
Go to the client directory:
> cd client
Run the React app:
> npm run start
Continue in your browser!
More at https://github.com/OpenZeppelin/starter-kit-tutorial

Hi! Thank you so much for being persistent in attempting to help me.

I finally resolved my problems by going back to the previous version of WSL2. It wasn’t obvious at first how to do that since I had just joined the Insider Program – but selecting the slow ring during re-installation (contrary to the instructions to select the fast ring) did the trick.

I have now successfully installed and am using the tutorial.

Thank you very much and hopefully my experiences will help someone else.

1 Like

Hi @MWaser,

Thanks for your patience, I am glad that you got there to run the tutorial. Feel free to ask all the questions that you need.

I haven’t tried WSL2 yet, I was waiting for it to be in a non Insider Program release and WSL works for pretty much everything I need to do.
I would be interested to know your thoughts on WSL2.

Hi,
I’m pretty sure this thread is my issue too. Just wanted to check in and quickly verify in relation to VSCode on Windows 10…(yes, I have configured the Juan Blanco extension per recommendations)

To avoid errors like this one on file imports with relative paths when importing an @openzeppelin\contracts-ethereum-package contract:

running ‘npx oz compile’ returns
@openzeppelin\contracts-ethereum-package\contracts\drafts\Counters.sol:3:1: ParserError: Source “math/SafeMath.sol” not found: File import callback not supported
import “…/math/SafeMath.sol”;
^----------------------------^

Are my only options:

  1. Run VSCode in a WSL instance
  2. Manually patch the path references (obvious drawbacks)

Could there be some other configuration issue I’m missing?

Thank you

Have you copied your @openzeppelin directory from the node_modules directory to the contracts directory? That fixed the problem for me.

I would note (per your options question), however, that I couldn’t get OpenZeppelin to install correctly unless I used WSL (a ton of node-gyp errors that I just couldn’t resolve). Now that I’m under WSL (which wasn’t so bad), it’s been clear sailing (well, except for the fact that Azure uses Byzantium—but the OpenZeppelin folks have been really helpful).

Good luck!

MArk

690A599C771F4BF7B424F4A7FC805F3C[33626041].jpg

1 Like

Thanks, @MWaser - I appreciate your thoughts.

I was noodling with the idea of just moving the contract structure over from node_modules for now, but wasn’t sure that would help…in addition to the problem of deviating from the standard development package.

That’s good to know WSL resolves the node-gyp warnings too - I was mostly just ignoring those for now.

Best, Kev

1 Like

Hi @kev,

I would recommend using WSL, this is what I use every day (I haven’t tried WSL2 yet). You will run into far fewer issues. Microsoft documentation is recommending WSL2 for node projects: https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows#use-windows-subsystem-for-linux-for-production

I would avoid moving the OpenZeppelin Contracts from node_modules as we don’t want to make any changes to OpenZeppelin Contracts, only inherit from a release.

I tried to test on a pure Windows environment but my old laptop is not coping well installing npm packages. I think you are best using WSL.

I’ve been using WSL2. I’ve had no problems other than it requires you to join the free Windows Insider program and there have been a couple of Fast Ring updates that have broken WSL2. Using the Slow Ring (you’ll understand when you signup) has always worked so do that despite the instructions.

I had major, unsolvable (by me) problems with node_gyp when I didn’t use WSL.

The instructions for WSL2 are at https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2

690A599C771F4BF7B424F4A7FC805F3C[33626041].jpg

1 Like

Thanks @MWaser and @abcoathup. I did in fact switch to WSL and, after tinkering with the WSL config a bit have a development project box/environment/process that works with the things I want in it - oz-cli, contracts-ethereum-package, test-environment+mocha+chai. That is, the box installs, surviving build errors with the many dependencies on specific versions of node and python, etc., and compiles with relative path contract imports.

For those who might read this in the future, I’d note that some of these packages have specific node and python version dependencies when they build out sub-components. I can confirm that, while cli@rc (rc-2) of 2.8 works with node 13, test-environment does not, so the node version I successfully chose was 10.16.0. Also, test-environment needs python 2 (I can confirm 2.7 works). (Related to Issue #252, which is not just a windows 10 issue).

Some of these require specific tinkering, and I jotted down my steps for getting things running after the WSL basic install process. I could probably write those up in a recipe of sorts, if folks are interested.

Best,
Kev

1 Like

Hi @kev,

It would be great if you had notes that you could share after installing WSL. That could be helpful for new developers.

What was the error you got with OpenZeppelin Test Environment on node 13? I would like to reproduce and create a GitHub Issue.

You bet, @abcoathup - I’ll try to put something together in the next couple of days.

I don’t recall the exact error with test-environment, but believe it is the same one you get with oz-cli v 2.7.1 - the node-gyp keccak build errors (same or very similar to @MWaser code snippet above in this thread).

I never tried node v12.xx. - I moved straight down from node 13 to node 10 because I knew that, at least, worked before on my windows installs.

Once I got through the node errors with test-environment, I got the python errors (see, e.g., issue #252) with string formats and had to move down to 2.7.

I imagine a person might not even notice these issues if they installed WSL some time ago and had all these versions carrying forward from many installs of things over the years, but, being new to WSL I started with fresh and up to date dependencies that were not the ones relied on by some of the oz components’ imported libraries.

1 Like

Exactly my experiences with WSL 2. I always use the Node LTS (currently 12) not the Current (currently 13) because I hate bugs I can avoid. Python 3 which has too many breaking changes from Python 2 has never worked for building for me (and I believe everyone).

690A599C771F4BF7B424F4A7FC805F3C[33626041].jpg

1 Like

Hi @kev & @MWaser,

Thank you :pray:.

I use node 10 on a daily basis as I don’t have any problems.
node 12 is ok, whilst I have run into ecosystem issues with node 13.