Converting ERC20 to ERC777 and errors with: Cannot find module ‘@openzeppelin/test-helpers’

Hi abcoathup,
I unbox the truffle drizzle, and alter the erc20 token to erc777. I have installed openzepplin test helper. But when i deploy the contract, i get error message:

Error: Cannot find module ‘@openzeppelin/test-helpers’
Require stack:

  • /usr/local/lib/node_modules/truffle/node_modules/original-require/index.js
  • /usr/local/lib/node_modules/truffle/build/cli.bundled.js

this is my project… i switch the node version from 13 to 12 to 8… but still would not work…
may I know what is the cause of the problem? thanks

1 Like

Hi @stepheniecvc,

openzeppelin-test-helpers is now called @openzeppelin/test-helpers.

To resolve you can uninstall openzeppelin-test-helpers and install @openzeppelin/test-helpers.

You can see this being used in my Simple ERC777 token example

Please ask all the questions that you need.

hi thank you so much… i can deploy the contract now

1 Like

Hello,

I am newbie here and I have still a problem to use the test helpers.

Here it is my trace:

pc15:client alexandre$ truffle test/votingGUI.test.js
Using network 'test'.


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Error: Cannot find module '@openzeppelin/test-helpers'
Require stack:
- /Users/alexandre/WebstormProjects/VotingGUI/test/votingGUI.test.js
- /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js
- /usr/local/lib/node_modules/truffle/node_modules/mocha/index.js
- /usr/local/lib/node_modules/truffle/build/cli.bundled.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/Users/alexandre/WebstormProjects/VotingGUI/test/votingGUI.test.js:1:43)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:390:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:387:14)
    at Mocha.run (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:961:10)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:151:1
    at new Promise (<anonymous>)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:150:1)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/test/index.js:187:1)
    at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:167:1)
Truffle v5.3.13 (core: 5.3.13)
Node v14.17.1
pc15:client alexandre$

However, I did, before in the directory client: (where I have node_modules directory and package.json), these commands:

npm uninstall openzeppelin-test-helpers

npm install @openzeppelin/test-helpers

It sounds strange for me… During my research, have you got any clues to give me please?

Update

When I try to uninstall @openzeppelin/test-helpers, I have this now:

pc15:client alexandre$ npm uninstall  @openzeppelin/
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/bignumber.js
npm ERR! dest /Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/.bignumber.js-lw5gloMD
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/bignumber.js' -> '/Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/.bignumber.js-lw5gloMD'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexandre/.npm/_logs/2021-08-02T07_40_40_528Z-debug.log
pc15:client alexandre$ npm uninstall @openzeppelin/test-helpers
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/bignumber.js
npm ERR! dest /Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/.bignumber.js-lw5gloMD
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/bignumber.js' -> '/Users/alexandre/WebstormProjects/VotingGUI/client/node_modules/.bignumber.js-lw5gloMD'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexandre/.npm/_logs/2021-08-02T07_41_34_453Z-debug.log

I think it’s a problem with my node.js installed after some reading. I am about to uninstall and reinstall Node.js on my mac, what do you think?

Cordially,

Hello,

I found the solution! You have to install the dependencies with NPM at the root of your project. So you have to see a "node_modules" directory at the root to recognize the helpers dependencies.

Cordially,

Moreover, I prefer to show you a screenshot to be clear:

And after, to run the tests, you run the command:

truffle test test/ERC20.test.js

Ale