Terry Windwalker
Terry Windwalker

Reputation: 1888

Slither cannot find the dependency with @openzeppelin

Error: Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File not found. Searched the following locations: "".

Currently, all dependencies from @openzeppelin are showing errors like this. But those dependencies have been installed in my node_modules and I don't know why it can't find the file. Is there a way I can set the location, or should I install the @openzeppelin/contracts globally?

UPDATE:I can see that --base-path should be set for solc, but I am still not sure how to apply such setting to slither.

Upvotes: 2

Views: 1336

Answers (1)

Terry Windwalker
Terry Windwalker

Reputation: 1888

I found a (might be dirty) way to solve it:

Step 1: Go to the directory where all your dependencies are.

In my case, do cd node_modules

Step 2: Call the same command with the updated relative path.

In my case, from slither contracts/MyContract.sol to slither ../contracts/MyContract.sol

And it just works. After going through the doc, I don't think Slither is providing a way to adjust --base-path as a flag.

Upvotes: 3

Related Questions