eth.getCompilers() shows empty array

winksavillewinksaville Posts: 5Member
Following the instructions for Greeter and go-ethereum wiki for Contract-Tutorial both say to check if solc installed by doing:

> eth.getCompilers()
[]
>

But as you can see it returns an empty array where as it's expected to return:

> eth.getCompilers()
['Solidity']
>


But I had installed it via "npm install -g solc" as suggested here. But that seems to actually install "solcjs" not "solc" so that didn't work. What I finally did was build solidity from source following these instructions and then I added the resulting path to solc, which on my system is "$HOME/foss/solidity/build/solc/", to my $PATH and then things worked:

> eth.getCompilers()
["Solidity"]
> var greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }'
undefined
> greeterSource
"contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }"
> var greeterCompiled = web3.eth.compile.solidity(greeterSource)
undefined
>

(Note: the "undefined" lines you see above can be ignored according to the answer I got here)


So why did I have to install from sources, I would have expected the "npm install -g solc" to work?
Sign In or Register to comment.