0

This has been months worth of troubleshooting. I cannot npm install bcrypt no matter what I try.

I've tried sudo npm install bcrypt, brew install bcrypt, uninstalling node and reinstalling node, copying bcrypt files and editing my json files... Nothing works. Tested with alternatives to bcrypt, such as bcryptjs. This is only a problem with bcrypt packages, and I have tried dozens of suggestions and solutions I've found online to no avail.

Brew tells my bcrypt is installed, so I uninstall it through brew and it says it is still installed. I've done npm uninstall bcrypt -g just in case, but it still doesn't work. It says I don't have access to my node_modules folder, but, again, this only happens with bcrypt and literally nothing else. Express, postgresql, cors, body-parser, react, redux, thunk... Everything else installs and works without any issue.

npm WARN checkPermissions Missing write access to /Users/someUser/Desktop/realtorSite/server/node_modules
npm WARN server@1.0.0 No description
npm WARN server@1.0.0 No repository field.

npm ERR! path /Users/someUser/Desktop/realtorSite/server/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/someUser/Desktop/realtorSite/server/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/Users/someUser/Desktop/realtorSite/server/node_modules'] {
npm ERR!   stack: 'Error: EACCES: permission denied, access ' +
npm ERR!     "'/Users/someUser/Desktop/realtorSite/server/node_modules'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/someUser/Desktop/realtorSite/server/node_modules'
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/someUser/.npm/_logs/2019-06-16T22_38_43_256Z-debug.log

I just want to figure out what is wrong and be able to regularly use bcrypt and other encryption-based packages.

  • `cd /Users/someUser/Desktop/realtorSite/server && rm -r node_modules && npm install` – Lawrence Cherone Jun 16 '19 at 23:00
  • doesn't resolve the issue, but i figured it out. No clue how I missed this for so long, but all my npm permissions were set to root. I have no clue why only bcrypt was blocked by this and why sudo wouldn't fix it, but I changed all permissions to myself instead of root. – R. Lorenzini Jun 16 '19 at 23:03
  • Possible duplicate of [Error: EACCES: permission denied, access '/usr/local/lib/node\_modules' react](https://stackoverflow.com/questions/48910876/error-eacces-permission-denied-access-usr-local-lib-node-modules-react) – Lawrence Cherone Jun 16 '19 at 23:14

1 Answers1

0

https://lightrains.com/blogs/fixing-npm-permissions-install-global

This link is how I fixed my issue. First, I used npm config get prefix to find my npm directory and cd ~ to get to my root directory. I then ran ls -a and found a node_modules folder in my root. By using ls -la node_modules, I found root was given all permissions by I had no rights. sudo chown -R someUser node_modules changed all permissions inside of node_modules to someUser instead of root.

Tested npm install bcrypt and it installs without issue.