I'm using vim with the syntastic plugin.

I'm getting this message:

Source "zeppelin-solidity/contracts/token/StandardToken.sol" not found: File outside of allowed directories. [solidity/solc]

when editing a .sol file in <prj-root>/contracts (as per truffle init)

zeppelin-solidity was installed by yarn add into <prj-root>/node_modules.

I tried creating a symlink in the contracts directory and running vim from the same directory, and still get the same warning.

I also tried running vim inside the node_modules directory so that the path wouldn't involve a symlink:

$ pwd                                          
$ ls                                           
$ vim ../contracts/CapitalCoin.sol

How can I silence this error?


This could be related to the restrictions of solc. From the documentation at http://solidity.readthedocs.io/en/v0.4.21/using-the-compiler.html:

For security reasons the compiler has restrictions what directories it can access. Paths (and their subdirectories) of source files specified on the commandline and paths defined by remappings are allowed for import statements, but everything else is rejected. Additional paths (and their subdirectories) can be allowed via the --allow-paths /sample/path,/another/sample/path switch.


I was able to get it to go away by placing the following into my .vimrc

let g:syntastic_solidity_solc_args = "--allow-paths"

However I'm not confident since running:

solc contracts/CONTRACT.sol --allow-paths

doesn't pass without a list.

I've tried running it with a list and denoting all:

solc contracts/CONTRACT.sol --allow-paths *

but that also fails.

I did a comma and it seems to work, though it looks improperly formatted IMO.

solc contracts/CONTRACT.sol --allow-paths *,

I followed: syntastic 4.5. Q. How can I pass additional arguments to a checker?


Alternatively you can Download "Zapplin" Lib(Size in few kbs) from github and manually place that in your project's root folder. Then try to import "StandardToken.sol" directly. I have not much experience in Truffle. But might be this can help you out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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