[Ethereum] Source “” not found: File outside of allowed directories. [solidity/solc]


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?

Best Answer

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.

Related Topic