File import callback not supported

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

I also have this issue on Win10, following the docs learn example: https://docs.openzeppelin.com/learn/developing-smart-contracts

Edit: I changed to the wsl-ubuntu terminal, installed nvm and node, and now the npx oz compilation works fine on my project with no callback errors.

1 Like

Hi @viltiki,

I am glad you were able to resolve. I use Windows Subsystem for Linux too.

For community members coming across this, the options for Solidity Smart contract development on Windows are:

1 Like

just heads up I just filed an issue with pull request to support it without WSL since the connection in WSL is not really stable in my experience, so I still prefer use it natively. https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1558

1 Like

Hi @yurenju,

Welcome to the community :wave:.

Thanks for creating the issue.

I have used WSL and now use WSL2 without issues, so sorry to hear that you have problems with it.

I definitely will try WSL2 when the upgrade rolling on my laptop :crossed_fingers:

1 Like

@abcoathup

I’m having the same Issue: Source “@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol” not found: File import callback not supported

with:
import “@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol”;

I just follow the tutorial https://docs.openzeppelin.com/learn/sending-gasless-transactions

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24 <0.7.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();
    }

    // We won't do any pre or post processing, so leave _preRelayedCall and _postRelayedCall empty
    function _preRelayedCall(bytes memory context) internal returns (bytes32) {
    }

    function _postRelayedCall(bytes memory context, bool, uint256 actualCharge, bytes32) internal {
    }
}

The only change is with the version of solidity used. I need help, I’m using Linux, Ubuntu 18.04

1 Like

Hi @Gabriel1590,

Welcome to the community :wave:

Please see this post for how to upgrade the contract to Solidity 0.6 and use OpenZeppelin Contracts Ethereum Package v3.

Thanks, I just updated. I also solve the issue with the import by doing this way:
import "../node_modules/@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol";

1 Like

Hi @Gabriel1590,

Glad you are up and running.

You should be able to do import "@openzeppelin... and you shouldn’t need to have "../node_modules

it should, but gives me the same error than before

1 Like

A post was split to a new topic: File import callback not supported on MacOS

Solved the issue by removing ../ from import paths:

Before (failure):

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/../../Initializable.sol";

After (success):

import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
1 Like

Hi @DenGorbachev,

Welcome to the community :wave:

If you haven’t seen it already, recommend reading The Future of contracts-ethereum-package.

openzeppelin-contracts/contracts/access/Ownable.sol:5:1: ParserError: Source “openzeppelin-contracts/contracts/GSN/Context.sol” not found: File import callback not supported
import “…/GSN/Context.sol”;
^--------------------------^
,openzeppelin-contracts/contracts/token/ERC20/ERC20Pausable.sol:5:1: ParserError: Source “openzeppelin-contracts/contracts/token/ERC20/ERC20.sol” not found: File import callback not supported
import “./ERC20.sol”;
^-------------------^
,openzeppelin-contracts/contracts/token/ERC20/ERC20Pausable.sol:6:1: ParserError: Source “openzeppelin-contracts/contracts/utils/Pausable.sol” not found: File import callback not supported
import “…/…/utils/Pausable.sol”;
^--------------------------------^

1 Like

Hi @sabotagebeats,

Welcome to the community :wave:

I am sorry that you have this issue.
If you are using Windows, I suggest running Windows Subsystem for Linux (WSL2): Solidity Smart Contract development on Windows

Please note: All development on the GSN has been moved to the OpenGSN organization.

If you are doing GSN development I recommend joining the OpenGSN Telegram: https://t.me/joinchat/F_BETUjG0Crb2s6mFx1LWA

A post was split to a new topic: File import callback not supported on WSL

Hi @abcoathup

I am getting the error "Unable to generate Contract bytecode and ABI (General Exception, unable to get compiled [bytecode]

And also

ParserError: “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol” not found: File import call back not supported

I need a professional help!