Hi,
I've got a problem using the npx truffle migrate --network development command while following the tutorial on your site (https://docs.openzeppelin.com/learn/deploying-and-interacting).
The Box.sol Contract compiles successfully but then i get the following message:
Compiling your contracts...
===========================
> Compiling .\contracts\Box.sol
> Artifacts written to C:\Users\marco\boilerplates\contracttester\build\contracts
> Compiled successfully using:
- solc: 0.8.17+commit.8df45f5f.Emscripten.clang
Starting migrations...
======================
> Network name: 'development'
> Network id: 1675505810979
> Block gas limit: 6721975 (0x6691b7)
2_deploy.js
===========
C:\Users\marco\boilerplates\contracttester\migrations\2_deploy.js:3
modules.exports = async function (deployer) {
^
ReferenceError: modules is not defined
at C:\Users\marco\boilerplates\contracttester\migrations\2_deploy.js:3:1
at Script.runInContext (node:vm:141:12)
at Object.file (C:\Users\marco\boilerplates\contracttester\node_modules\truffle\build\webpack:\packages\require\dist\index.js:90:1)
at Migration.<anonymous> (C:\Users\marco\boilerplates\contracttester\node_modules\truffle\build\webpack:\packages\migrate\dist\src\Migration.js:78:1)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\marco\boilerplates\contracttester\node_modules\truffle\build\webpack:\packages\migrate\dist\src\Migration.js:28:43)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Truffle v5.7.5 (core: 5.7.5)
Node v16.19.0
Box.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Box {
uint256 private _value;
// Emitted when the stored value changes
event ValueChanged(uint256 value);
// Stores a new value in the contract
function store(uint256 value) public {
_value = value;
emit ValueChanged(value);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return _value;
}
}
2_deploy.js:
const Box = artifacts.require('Box');
modules.exports = async function (deployer) {
await deployer.deploy(Box);
}
Since I'm still learning I have no idea what this error tells me. Any help would be appreciated.