Fund:0.012 ETH / $6.94
Question is solved

I am stuck installing ‘solc’.

1 month ago

I am able to install it using “sudo npm install -g solc” and I get back:
/usr/local/bin/solcjs -> /usr/local/lib/node_modules/solc/solcjs
+ solc@0.4.19
updated 1 package in 3.123s

But when I try to test it in node I get:
Users-Air:~ user$ node
> require(“solc”)
Error: Cannot find module ‘solc’
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)

What do I need to do??


There is a bug with the global installation of solidity ( But you can add a package.json file to the folder where you have your project, add the version of Solidity you want (probably version 0.4.19) to the dependencies, like this:

"dependencies": {
"solc": "0.4.19",

And then run npm install. Then it will work. You can download any other libraries or dependencies you have the same way by adding them to your package.json file and running npm install in the command line.

If you’re still running into this issue after trying it with package.json, it might be an issue with version 0.4.19 of Solidity, so change the version inside the package.json file to “0.4.17”. Because these libraries are still very new and being updated / changed a lot, the newest versions will have some kinks. Alternatively, you can run your Solidity code inside, which is a browser IDE that lets you make smart contracts and deploy them to the blockchain without downloading anything.
1 month ago

Your question is successfully refund. You will be redirect in few seconds.