0

I am currently really struggling in getting Truffle up and running. I am running MacOS Mojave and have Node (v.10.16.0) and NPM (6.9.0) and have tried

npm install -g truffle

and have gotten:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules

npm ERR! path /usr/local/lib/node_modules

npm ERR! code EACCES

npm ERR! errno -13

npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']

npm ERR! stack:

npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',

npm ERR! errno: -13,

npm ERR! code: 'EACCES',

npm ERR! syscall: 'access',

npm ERR! path: '/usr/local/lib/node_modules' }

npm ERR!

npm ERR! The operation was rejected by your operating system.

npm ERR! It is likely you do not have the permissions to access this file as the current user

npm ERR!

npm ERR! If you believe this might be a permissions issue, please double-check the

npm ERR! permissions of the file and its containing directories, or try running

npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/myname/.npm/_logs/2019-07-09T21_08_31_313Z-debug.log

And when I try

sudo npm install -g truffle

I get:

Password:

npm ERR! path /usr/local/bin/truffle

npm ERR! code EEXIST

npm ERR! Refusing to delete /usr/local/bin/truffle: /Users/vikas/.nvm/versions/node/v9.11.2/bin/truffle symlink target is not controlled by npm /usr/local/bin

npm ERR! File exists: /usr/local/bin/truffle

npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/robertocantu/.npm/_logs/2019-07-09T21_13_07_178Z-debug.log

If you know what I can do, please explain it as simple as possible. I am not too well versed in doing things in Terminal; I'm just trying to learn how to program smart contracts and I can't seem to even set up my computer to do so.

0

Have a look at the npm documentation for resolving eaccess permissions when installing packages globally. https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

I would suggest resolving the permissions issue using a node version manager.
Note: Currently truffle doesn't work with node 12 so use either node 10 or node 11.


You don't have to install truffle globally. I generally install it locally npm install truffle and then run using npx, npx truffle test.

https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b

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.