0

I'm executing below command:

abigen --sol helloworld.sol --pkg main --out helloworld.go

But getting below error: Failed to build Solidity contract: exec: "solc": executable file not found in $PATH

When I check echo $PATH, solcjs is present.

echo $PATH
/home/edureka/go/bin:/usr/local/go/bin:/home/edureka/.local/share/umake/bin:/home/edureka/bin:/home/edureka/.local/bin:/home/edureka/.nvm/versions/node/v6.11.4/bin:/home/edureka/go/bin:/usr/local/go/bin:/home/edureka/.local/share/umake/bin:/home/edureka/bin:/home/edureka/.local/bin:/home/edureka/.local/share/umake/bin:/home/edureka/bin:/home/edureka/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/edureka/.nvm/versions/node/v6.11.4/bin/solcjs

How I can solve this error?

Volker
  • 40,468
  • 7
  • 81
  • 87
Vikas Banage
  • 494
  • 1
  • 8
  • 25
  • Can you please check if you have `solc` bin in this path? /home/edureka/.nvm/versions/node/v6.11.4/bin/solcjs abigen is trying to find `solc`, not `solcjs`. – Alex Pliutau Jan 07 '19 at 10:26
  • solc isn't on your $PATH you can either add it to your $PATH or set the environment variable SOLC_BINARY to the path to the solc executable – Vishwa Ratna Jan 07 '19 at 10:29

3 Answers3

2

You have to install solc not solcjs.

https://solidity.readthedocs.io/en/v0.4.24/installing-solidity.html

The comandline options of solcjs are not compatible with solc and tools (such as geth) expecting the behaviour of solc will not work with solcjs.

You have to install a binary package - https://solidity.readthedocs.io/en/v0.4.24/installing-solidity.html#binary-packages

Alex Pliutau
  • 21,392
  • 27
  • 113
  • 143
1

You should install solc. Check here.

0

This is mostly due to solc specific version not in your path.

To see which version of solc

solc --version

where is your solc installed ?

whereis solc

Add the output of the above command to your PATH.

   export PATH=$PATH:{output_from_above_command}

This should resolve your solc not present in the PATH issue.

Please note that you need specific version tag. 0.7.6 or 0.8.0 etc... Any typos will not pick correctly.