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:
- Created 6 years ago
- Comments:25 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 ?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