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.