I started a project with truffle init, and I am trying to write a test and I have an import like so:

import "truffle/Assert.sol";

I get an error:

Error: Could not find truffle/Assert.sol from any sources;

How do I fix this? Is Assert a built-in truffle library or do I have to install it separately?


1 Answer 1


Running truffle test from the command line should import the Assert.sol library if truffle was installed globally (using npm install -g truffle).

If truffle is globally installed, the "Assert.sol" file should be located in the directory


If things still don't work you could try copying the "Assert.sol" (and its imported dependencies, of which there's several) to your "contracts" folder and then importing it from there into your test contract. But it's probably best to just get truffle installed globally and then use truffle test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.