File import callback not supported

In GSN tutorial, When compiling the Counter contract(oz compile) I got the following errors(in short):

Compiling contracts with solc 0.5.11 (commit.c082d0b4)
Compilation errors:
@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol:4:1: ParserError: 
Source "@openzeppelin/contracts-ethereum-package/contracts/GSN/IRelayRecipient.sol" not found: File import callback not supported
import "./IRelayRecipient.sol";

@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol:5:1: ParserError: Source "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNContext.sol" not found: File import callback not supported
import "./GSNContext.sol";

:computer: Environment
Windows 10 pro
node 10.16.3 and npm 6.9.0
Truffle 5.0.25

Just followed the GSN tutorials on Windows 10
I have searched similar problems of “File import callback not supported” in truffle-suite issues, but no help.

:1234: Code to reproduce
npm init -y
oz init
paste Counter.sol to contracts directory
oz compile

Any suggestion? I don’t want to add full path to import:
import “./IRelayRecipient.sol”; to import “@openzeppelin/contracts-ethereum-package/contracts/GSN/IRelayRecipient.sol”; :joy:

1 Like

Hi @swkim109,

Welcome to the community :wave:

Which tutorial are you following?
I assume that you are using:

Are you able to share your Counter.sol contract?

Yes, I just copy and paste:

pragma solidity ^0.5.0;

import "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol";

contract Counter is GSNRecipient {
    uint256 public value;

function increase() public {
    value += 1;

function acceptRelayedCall(
    address relay,
    address from,
    bytes calldata encodedFunction,
    uint256 transactionFee,
    uint256 gasPrice,
    uint256 gasLimit,
    uint256 nonce,
    bytes calldata approvalData,
    uint256 maxPossibleCharge
) external view returns (uint256, bytes memory) {
    return _approveRelayedCall();

Hi @swkim109,

I haven’t been able to reproduce yet. Could you share your package.json?

I use Windows Subsystem for Linux (WSL) on Windows 10.
You may want to consider using WSL too:

It is OK for Linux(I tested same thing in Docker container) but still errors on Windows(can’t find files of relative path such as import “./IRelayRecipient.sol”).

I have found the similar issues in truffle suites. I guess the causes are same as this one.

This is package.json

  "name": "oz-gsn",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@openzeppelin/contracts-ethereum-package": "^2.2.3",
    "@openzeppelin/upgrades": "^2.5.3"
1 Like

Hi @swkim109,

I didn’t see anything obvious in your package.json. Given that it works for you on Linux it may be Windows specific.

You may want to update to the latest version of truffle and try again as truffle is now at 5.0.35.

npm uninstall -g truffle
npm install -g truffle

Otherwise we (either you or I) can log with Truffle in case it is similar to the previous Windows issue.

I have had much fewer issues since moving to using Windows Subsystem for Linux, though it sounds like you can spin up a Linux environment when needed.

OK, Thanks.
I just wanted to do it on Windows because I usually do many things with Windows. :sweat_smile:

1 Like

Hi @swkim109,

I use Windows (except for smart contract development) :smile:

Did you get a chance to try with the latest version of truffle?
If it is still occurring we should report to Truffle as it appears to be Windows specific.

I have upgraded to Truffle 5.0.36 but same error(File import callback not supported) occurred on Windows 10.

In truffle, importing files with relative path works fine. For example, I write the ERC20 token contract:

pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";

contract SSGToken is ERC20Mintable, ERC20Detailed("SSG Token", "SSG", 18) {

    constructor ()  public {
        mint(msg.sender, (10**9)*(10**18)); //1 billion

ERC20Mintable.sol has

import "./ERC20.sol";
import "../../access/roles/MinterRole.sol";

truffle compile works perfect.
I doubt there is something different in oz compile and @openzeppelin/contracts-ethereum-package.

I’m using WSL now(as you suggested) and oz compile works great. :slightly_smiling_face:

1 Like