I'm trying to use solc with no success.
I download solc with npm install solc but when I run solc --version the console output is:
command not found.
If I list packages npm list I'm able to see solc@0.3.5.
What's wrong?
I'm trying to use solc with no success.
I download solc with npm install solc but when I run solc --version the console output is:
command not found.
If I list packages npm list I'm able to see solc@0.3.5.
What's wrong?
If you have installed through npm install -g solc
Here's how you use it. solcjs --version
solc and then run solcjs... Please.
– Mars Robertson
Nov 25 '17 at 11:13
You should add solc to PATH. Type which solc to get the location where the solidity compiler is installed and add this to PATH. If you just want to check the version, navigate to the location where solidity is installed and then type in the command solc --version.
pippo-MacBook-Pro:~ pippo$ which solc pippo-MacBook-Pro:~ pippo$
– underdog Jun 20 '16 at 19:45So, solc always require cpp-ethereum, is not stand-alone?
– underdog Jun 20 '16 at 20:00npm install solc doesn't install a global solc tool, or how to install a compiler instead.
– graup
Jul 17 '16 at 22:17
npm install solc currently does not install a globally available compiler. The solc npm package are just Javascript bindings to use in a Javascript module.
After struggling with this myself for some time, there currently seems to be no convenient way to install a standalone Solidity compiler, at least on Mac OS X.
Expanding on @graup, I've reinstalled solc from my contracts directory of each new contract project, which has worked for me:
cd contracts
npm install solc
npm install ethereumjs-testrpc web3@0.20.1
node
Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
code = fs.readFileSync('MyContrat.sol').toString()
solc = require('solc')
compileCode = solc.compile(code)
Had similar issue after installing globally, but npx solc --version fetched the version
Here is how you can add to path if you have installed via python3 using pip3!
export PATH=$PATH:/Users/nolanjacobson/Library/Python/3.8/bin
npm i solc@version
By using this command you can do the installation of your required version solidity.