I use the SDK as normal.
I oz compile
.
Then sometimes suddenly my console errors when I want to use oz
commands.
I got rid of the problem by deleting
my node_modules
folder and npm
reinstalling them. The oz commands
then worked as they should for some time.
But then the error Cannot find module 'create-hash'
reappeared. It is hard to reason about any steps that might have led up to this error. I did not delete or install anything new into the project folder in the interim.
This must have something to do with the node_modules/
directory though, as every time I delete it and npm install
the error goes away.
I should also mention that at certain times I had a oz session
configured - maybe something happened due to that.
Environment
@openzeppelin/cli@2.5.3
nothing else
1 Like
Hi @gitpusha,
Looking at your packages installed, you currently have @openzeppelin/contracts
rather than @openzeppelin/contracts-ethereum-package
:
https://docs.openzeppelin.com/sdk/2.5/linking
Make sure you install @openzeppelin/contracts-ethereum-package
and not the vanilla @openzeppelin/contracts
. The latter is set up for general usage, while @openzeppelin/contracts-ethereum-package
is tailored for being used with the OpenZeppelin SDK. This means that its contracts are already set up to be upgradeable.
Though use version 2.2.3 due to https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/issues/70
oz link @openzeppelin/contracts-ethereum-package@2.2.3
Other than the above, there is nothing that I am aware of which would cause the issue you are seeing.
I have tried recreating but haven't been able to reproduce unfortunately (using Windows Subsystem for Linux).
$ npm list --depth=0
deep@1.0.0 /mnt/c/Users/andre/Documents/projects/forum/deep
├── @openzeppelin/contracts@2.3.0
├── @openzeppelin/upgrades@2.5.3
├── @truffle/hdwallet-provider@1.0.22
└── dotenv@8.2.0
$ npm list create-hash
deep@1.0.0 /mnt/c/Users/andre/Documents/projects/forum/deep
├─┬ @openzeppelin/upgrades@2.5.3
│ └─┬ web3@1.2.1
│ └─┬ web3-eth@1.2.1
│ └─┬ web3-eth-accounts@1.2.1
│ └─┬ crypto-browserify@3.12.0
│ ├─┬ browserify-sign@4.0.4
│ │ ├── create-hash@1.2.0 deduped
│ │ └─┬ parse-asn1@5.1.5
│ │ └── create-hash@1.2.0 deduped
│ ├── create-hash@1.2.0 deduped
│ └─┬ public-encrypt@4.0.3
│ └── create-hash@1.2.0 deduped
└─┬ @truffle/hdwallet-provider@1.0.22
├─┬ bip39@2.6.0
│ ├── create-hash@1.2.0
│ └─┬ pbkdf2@3.0.17
│ ├── create-hash@1.2.0 deduped
│ └─┬ create-hmac@1.1.7
│ └── create-hash@1.2.0 deduped
├─┬ ethereumjs-tx@1.3.7
│ └─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
├─┬ ethereumjs-util@6.1.0
│ ├── create-hash@1.2.0 deduped
│ └─┬ secp256k1@3.7.1
│ ├── create-hash@1.2.0 deduped
│ └─┬ drbg.js@1.0.1
│ ├─┬ browserify-aes@1.2.0
│ │ └── create-hash@1.2.0 deduped
│ └── create-hash@1.2.0 deduped
├─┬ ethereumjs-wallet@0.6.3
│ ├─┬ bs58check@2.1.2
│ │ └── create-hash@1.2.0 deduped
│ └─┬ hdkey@1.1.1
│ └─┬ coinstring@2.3.0
│ └── create-hash@1.2.0 deduped
└─┬ web3-provider-engine@14.0.6 (git+https://github.com/trufflesuite/provider-engine.git#3538c60bc4836b73ccae1ac3f64c8fed8ef19c1a)
├─┬ eth-block-tracker@3.0.1
│ └─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
├─┬ eth-json-rpc-infura@3.2.1
│ └─┬ eth-json-rpc-middleware@1.6.0
│ ├─┬ eth-tx-summary@3.2.4
│ │ └─┬ ethereumjs-util@5.2.0
│ │ └── create-hash@1.2.0 deduped
│ └─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
├─┬ eth-sig-util@1.4.2
│ └─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
├─┬ ethereumjs-block@1.7.1
│ ├─┬ ethereumjs-util@5.2.0
│ │ └── create-hash@1.2.0 deduped
│ └─┬ merkle-patricia-tree@2.3.2
│ └─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
├─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
└─┬ ethereumjs-vm@2.6.0
├─┬ ethereumjs-account@2.0.5
│ └─┬ ethereumjs-util@5.2.0
│ └── create-hash@1.2.0 deduped
└─┬ ethereumjs-block@2.2.0
└─┬ ethereumjs-util@5.2.0
└── create-hash@1.2.0 deduped
1 Like
Thanks for trying your best. I swapped my @openzeppelin/contracts for the @openzeppelin/contracts-ethereum-package@2.2.3, as per your advice.
1 Like