0

so I checked to see if I had the latest version of nodejs, and it turns out that I do.

kalebamarante$ node -v
v15.5.0

then I tried installing a version of Truffle and it didn't work

~ kalebamarante$ npm install --g truffle@5.1.39
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/truffle
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/truffle'
npm ERR! }
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kalebamarante/.npm/_logs/2021-01-22T00_28_36_853Z-debug.log

Then I went to the truffle website and copied the new link into my terminal and this happened.

KALEBS-MBP:~ kalebamarante$ npm install -g truffle
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/truffle
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/truffle'
npm ERR! }
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kalebamarante/.npm/_logs/2021-01-22T00_32_03_163Z-debug.log

I'm trying to work on a bigger project and I can't move forward until I have truffle installed. I appreciate all the help I can get!!

thank you

1
  • For developing purposes I'd suggest to use a tool like nvm to install node with user priviledges.
    – Ismael
    Aug 29 at 18:37
2

I manage to make it by installing HomeBrew first you can get this at this link: https://brew.sh/

You will have to type this before you start using brew command export PATH="/opt/homebrew/bin:$PATH"

After that type in brew update

Then after you successfully updated go for brew install node

When you have done all the stuff above you can try npm install -g truffle again. Until here you should not get any errors, at least I get to install truffle successfully. But I am still having a problem using the truffle command in my macOS Big Sur version 11.5.1.

Hope this will help you and good luck.

1

You are running into permission issues. MacOS is a Linux based operating system. Linux based operating systems require administrative privileges to make editorial changes to root directories. On MacOS you simply need to run with the sudo command:

sudo npm install --g truffle@5.1.39
1
  • MacOS is BSD based, not Linux based (Linux is just a kernel).
    – Ismael
    Aug 29 at 18:35
0

Access is denied because the node module folder is owned by the root. You will need to change the file permission.

Check out following link to see how to change permission.

https://stackoverflow.com/questions/48910876/error-eacces-permission-denied-access-usr-local-lib-node-modules/55628400#55628400

1
  • it says here that this only works on linux and unix. Will this work on MacOS? Jan 25 at 19:24
0

I just spent 2 days confused by a similar problem. After a seemingly successful installation of ganache-cli or truffle on Macbook pro, I got a command-not-found error. Finally, I looked into ~/npm-packages/bin. There are all the not-found-commands, and work just fine. I looked at .bash_profile, the ~/npm-packages/bin is in the PATH. While I look at .zprofile, it isn't. MacOS is pushing zsh as the default, but it seems npm does not realize it and still update only the bash profile. After I switched to bash, everything works like a charm.

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.