I am trying to install web3 on ubuntu 16.04 vm and I get the below error.

npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar

> [email protected] preinstall /home/ltu/web3/node_modules/scrypt
> node node-scrypt-preinstall.js

> [email protected] install /home/ltu/web3/node_modules/scrypt
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/ltu/web3/node_modules/scrypt/build'
gyp ERR! System Linux 4.13.0-38-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ltu/web3/node_modules/scrypt
gyp ERR! node -v v9.10.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/home/ltu/web3/package.json'
npm WARN web3 No description
npm WARN web3 No repository field.
npm WARN web3 No README data
npm WARN web3 No license field.

npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ltu/.npm/_logs/2018-04-20T10_50_03_804Z-debug.log

Any help please!!!

  • try first to update npm
    – Badr Bellaj
    Apr 21, 2018 at 7:59
  • npm is up to date. Installed version - V 5.8.0. I tried to restart the VM and it worked. :):)
    – K Kolluru
    Apr 21, 2018 at 8:30

2 Answers 2


Permissions of your node_modules is with root. This happens when you install some package globally using sudo or as root. In order to be able to install now, you need to run the install command with sudo

sudo npm install web3 -g
  • 1
    i ran it with sudo only. The issue was with the version of npm and it is resolved now.
    – K Kolluru
    Apr 21, 2018 at 12:43

If you use sudo to install packages, you will get "EACCES: permission denied" error next time when you install packages, because those packages installed via sudo will have root as their owner, instead of you being the owner.

install web3.js via yarn:

$ yarn add web3 --dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.