question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File import callback not supported

See original GitHub issue
  • I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

Attempting to import a dependency of a contract from a node module fails.

Steps to Reproduce

Can reproduce with the following script in a fresh directory

#!/bin/bash
truffle init
npm install --save zeppelin-solidity
ed contracts/MetaCoin.sol <<EOED
3a
import "node_modules/zeppelin-solidity/contracts/lifecycle/Pausable.sol";
.
wq
EOED

testrpc -d &
sleep 5
truffle compile

Expected Behavior

Expect contract to compile.

Actual Results

Compilation fails with the following output:

Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol...
Compiling node_modules/zeppelin-solidity/contracts/lifecycle/Pausable.sol...

node_modules/zeppelin-solidity/contracts/lifecycle/Pausable.sol:4:1: ParserError: Source "node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol" not found: File import callback not supported
import "../ownership/Ownable.sol";
^--------------------------------^
Compiliation failed. See above.

Environment

  • Operating System: Ubuntu 16.04.3
  • Truffle version: 3.4.11
  • Ethereum client: testrpc
  • node version: 8.5.0
  • npm version: 5.4.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
wighawagcommented, Jun 28, 2018

I had the same issue as @evgen-povt and after deleting the build/ folder it worked. There is an bug somewhere. could it be some caching issues ?

3reactions
evgen-povtcommented, Jan 23, 2018

It’s is not a path issue.

If the path is wrong it prints: Error: Could not find <path>/<filename1>.sol from any sources; imported from <path>/<filename2>.sol

But actual error is: <filename2>.sol:6:1: ParserError: Source "<filename1>.sol" not found: File import callback not supported

Read more comments on GitHub >

github_iconTop Results From Across the Web

File import callback not supported? - solidity - Stack Overflow
If you're using VSCode, this error is caused when your IDE fails to resolve the import paths.
Read more >
File import callback not supported - SDK - OpenZeppelin Forum
Where it somehow throws a DeclarationError: Identifier already declared across two unrelated import statements .
Read more >
File import callback not supported error in Foundry
I'm writing smart contract using Foundry. When I try to import contract from github like this:
Read more >
Source "@openzeppelin/contracts...." not found: File ... - GitHub
Hi all, I need some help trying to make this extension work with the @openzeppelin/contracts NPM package. I know issues like this have...
Read more >
Source not found: File import callback not supported
ParserError: Source “@openzeppelin/contracts/token/ERC721/ERC721.sol” not found: File import callback not supported → main-nft.sol:3:1:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found