=======
EDITS:
I found where the issue is:
I have a file called IERC20.sol
pragma solidity ^0.5.10;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
}
Somehow the .json that gets generated for this interface
has this problem: End of file expected
But somehow this error was not there initially, and then it crept up whilst I was coding and using oz
CLI
. I cannot remember the exact steps that led to this error suddenly appearing. I did not change the IERC20.sol
file itself. I only delete one import
of it in one file.
=========
I have recently ran into an issue on multiple occasions when trying to oz add
or oz create
after making some contract changes and running oz compile
again. Somehow this Unexpected string in JSON at position 23357
comes creeping up. Even though everything oz compile
s successfully.
Environment
macOS Catalina
oz/CL: 2.5.3
the rest:
βββ @openzeppelin/contracts@2.3.0
βββ @openzeppelin/upgrades@2.5.3
βββ @truffle/hdwallet-provider@1.0.22
βββ dotenv@8.2.0
nothing else
Details
I used the oz
cli
as normal. I do some stuff. I was able to oz create
. I do some more stuff. I want to oz create
again. This error creeps up. I delete the .openzeppelin
folder and I oz init
fresh again. I copy paste my contracts/
. I oz compile
successfully. Still oz create
or oz add
fail with Unexpected string in JSON at position 23357
.
Code to reproduce
Itβs very hard to reproduce. I guess you need to have macOS Catalina and
- mkdir test
- cd test
- npm init -y
- oz init
- make some contracts
- oz compile
- oz create
- do stuff
- do stuff
- rename a contract
- do stuff
- oz compile
- oz create
and maybe you get the error too.
This seems like a tough one. I would appreciate your help.