Hi, I got a compilation error while doing npx oz compile and the error is @openzeppelin/contracts/ownership/Ownable.sol:3:1: ParserError: Source "@openzeppelin/contracts/GSN/Context.sol" not found: File import callback not supported import "../GSN/Context.sol";
And this is my simple smart contract,
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/ownership/Ownable.sol";
contract Storage is Ownable {
uint256 private value;
function setValue(uint256 _value) public onlyOwner {
value = _value;
}
function getValue() public returns (uint256) {
return value;
}
}
I don’t know which part of the import statement is wrong. Is it in my contract or in openzeppelin’s one of the contracts? Any help would be appreciated
Hey @manolingam. I’ve just compiled your contract. It works fine. Do you compile with openzeppelin or truffle? Which versions do you use? What is your truffle.js or network.js file?
Hello @abcoathup,
I wanna use windows as my main development environment as I usually find it difficult to create a subsystem and manage resources for it. Hope someone helps me with the issue. And thanks for the suggestion anyways
Used your version still works fine for me. Which version of @openzeppelin/contracts": "^2.5.0" you use? What is inside of .openzeppelin/project.json? Which version of solc compiler it tries to use? ompiled contracts with solc 0.5.16 (commit.9c3226ce) for me.
The issue appears to be developing natively with Windows.
I vaguely remember (two years ago) having to swap the from / to \ in import statements though I haven’t been able to find any documentation on this.
I’m running Windows Subsystem for Linux with no issues. I unfortunately don’t have a pure Windows environment that I can use to reproduce at the moment.
Thanks for your response too @abcoathup. Since Igor can compile successfully in his environment, I wanna know what went wrong in mine. So, I would use Windows Subsystem as a secondary environment.
Hey @manolingam. You setup is perfectly valid. Unfortunately at that moment we don’t support windows as a platform directly. Your options would be to try Windows Subsystem for Linux or other platforms. I am sorry for inconvenience.
I am the Windows user in the team and after doing smart contract development on Windows 7 in 2017/2018, have used Windows Subsystem for Linux since 2018+ and haven’t looked back. I would encourage using WSL, and Microsoft’s recommendation is to use WSL for node projects for production.