Not able to install Solidity in Ubuntu

+1 vote

I am trying to install solidity on my system (Ubuntu 16). I am running the following command:

sudo npm install -g solc​

I am getting this error:

/usr/local/bin/solcjs -> /usr/local/lib/node_modules/solc/solcjs


> keccak@1.4.0 install /usr/local/lib/node_modules/solc/node_modules/keccak

> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."



> keccak@1.4.0 rebuild /usr/local/lib/node_modules/solc/node_modules/keccak

> node-gyp rebuild


gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/user/.node-gyp/8.10.0"

gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/solc/node_modules/keccak/.node-gyp"

gyp WARN install got an error, rolling back install

gyp WARN install got an error, rolling back install

gyp ERR! configure error

gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/solc/node_modules/keccak/.node-gyp'

gyp ERR! System Linux 4.15.0-42-generic

gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

gyp ERR! cwd /usr/local/lib/node_modules/solc/node_modules/keccak

gyp ERR! node -v v8.10.0

gyp ERR! node-gyp -v v3.8.0

gyp ERR! not ok

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the keccak@1.4.0 rebuild script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Keccak bindings compilation fail. Pure JS implementation will be used.

+ solc@0.5.1

added 76 packages from 30 contributors in 26.079s

How to solve this or how to install solidity?

Dec 12, 2018 in Blockchain by slayer
• 29,270 points
356 views

2 answers to this question.

+1 vote

Use this instead:

sudo snap install solc​
answered Dec 12, 2018 by slayer
• 29,270 points
+1 vote

As far as I can understand the file you need to install needs to install into root folder and right now you are not getting the permissions to do that, so simply getting into superuser mode would suffice.

To do that execute the following command :

sudo su
sudo npm install -g solc​


answered Nov 26, 2019 by DeadShotOne96
Hi @DeadShotOne96, that did not work for me. Can you please help me out!

Thank you!
Hi @Vipul, can you please mention the error logs

Related Questions In Blockchain

0 votes
1 answer
0 votes
1 answer

Blockchain peer not able to min block in Azure.

After trying out various ideas, making sure ...READ MORE

answered Aug 20, 2018 in Blockchain by Perry
• 17,090 points
50 views
0 votes
1 answer

Not able to invoke a contract in Ethereum Private chain using geth

Hope this helps: contract mortal { /* ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 69,000 points
70 views
0 votes
1 answer

Hyperledger Composer: not able to install Hyperledger composer-cli

Try setting the PATH like this, export PATH="/usr/local/share/npm/bin:$PATH" Now run the ...READ MORE

answered Oct 31, 2018 in Blockchain by Omkar
• 69,000 points
397 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,810 points
250 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,660 points
10,117 views
0 votes
1 answer
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,270 points
1,755 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,270 points
133 views