1

When I try to install solc (npm install solc or npm install -g solc) I actually can install it BUT when looking for it (through the command which solc) nothing shows up. Another strange thing: when looking for solcjs (through the command which solc) i get the correct path where it is indeed installed.

Things which I have already tried : uninstalling solc and solcjs and then re-installing them (which led to the same problem)

Other details : when I am in node.js and i try to do something like var solc = require('solc') no errors arise. Pretty strange one may think, well that's two of us.

Thanks in advance.

JoshuaDev
  • 53
  • 4

2 Answers2

0

Based on the solc command line usage documentation and this question on the ethereum stackexchange, you're not supposed to.

But, if you insist on doing so, it's best if you add solc's installation directory to your $PATH.

SSBakh
  • 1,487
  • 1
  • 14
  • 27
  • Actually that's not possible sisnce then command "wchich solc" does not give me any installation path – JoshuaDev Sep 06 '22 at 16:23
  • Checking the solidity documentation [here](https://docs.soliditylang.org/en/latest/installing-solidity.html), you're not gonna get anything. The documentation *literally* says "The commandline executable is named solcjs". You could make an alias if you want though. – SSBakh Sep 06 '22 at 18:12
0

I'm answering my own question to share the knowledge my collegue has finally shared with me: for my issue the following commands solved the problem (I did not initially mentioned that i was working on a MacOs my bad).

Step 1: Uninstall all possible version of solc (npm uninstall solc)

Step 2: brew tap ethereum/ethereum

Step 3: brew install solidity

This led to the correct creation of the path where solc is installed

JoshuaDev
  • 53
  • 4