0

I am running into permission issues when I try to install truffle

avi@avi-Inspiron-3542:~$ sudo npm install -g truffle
/usr/bin/truffle -> /usr/lib/node_modules/truffle/build/cli.bundled.js

keccak@1.4.0 install /usr/lib/node_modules/truffle/node_modules/keccak npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."

keccak@1.4.0 rebuild /usr/lib/node_modules/truffle/node_modules/keccak node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/avi/.node-gyp/11.6.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/truffle/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/lib/node_modules/truffle/node_modules/keccak/.node-gyp'
gyp ERR! System Linux 4.15.0-29-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/truffle/node_modules/keccak
gyp ERR! node -v v11.6.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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/avi/.npm/_logs/2019-01-05T10_04_02_789Z-debug.log
Keccak bindings compilation fail. Pure JS implementation will be used.
+ truffle@5.0.1
added 90 packages from 305 contributors in 7.547s
  • Try installing it without sudo . From the error root doesnt have access to /home/avi/. I would also check what the permission are on that folder ls -lHf – Samuel Dare Jan 5 at 10:13
  • and why not just npm install -g truffle ? – Samuel Dare Jan 5 at 10:14
  • if this keeps playing up, take out the g flag and install it locally in folder while you result your persmission issues npm install truffle – Samuel Dare Jan 5 at 10:17
  • ok thanks @Data_Kid, I will try those commands. I appreciate your help – Avishai Jan 6 at 11:50
2

The issue is more node / npm related than it is blockchain.

Its to do with a difference between your version of node and the gyp version

run:

sudo npm install -g truffle --unsafe-perm

It should work now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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