Introducing solcjs
solcjs is a Node.js library and command-line tool that is used to compile solidity files. It doesn't use the solc command-line compiler; instead, it compiles purely using JavaScript, so it's much easier to install than solc.
Solc is the actual Solidity compiler. Solc is written in C++. The C++ code is compiled to JavaScript using emscripten. Every version of solc is compiled to JavaScript. At https://github.com/ethereum/solc-bin/tree/gh-pages/bin, you can find the JavaScript-based compilers of each solidity version. solcjs just uses one of these JavaScript-based compilers to compile the solidity source code. These JavaScript-based compilers can run in both browser and Node.js environments.
Note
The browser Solidity uses these JavaScript-based compilers to compile the Solidity source code.
Installing solcjs
solcjs is available as an npm package with the name solc
. You can install the solcjs
npm package locally or globally just like any other npm package. If this package is installed...