fixmynode
v0.0.4
Published
fixes file permissions on shitty node installations
Downloads
4
Readme
Fixmynode - Fixes the permisssions on your node installation on OSX.
Install with:
npm install -g fixmynode
Do you constantly get this annoying error?
npm ERR! Error: EACCES, open '/Users/YOUR_USERNAME/.npm/-/all/.cache.json'
npm ERR! { [Error: EACCES, open '/Users/YOUR_USERNAME/.npm/-/all/.cache.json']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/YOUR_USERNAME/.npm/-/all/.cache.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "search" "bower"
npm ERR! cwd /Users/YOUR_USERNAME
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! path /Users/YOUR_USERNAME/.npm/-/all/.cache.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/YOUR_USERNAME/.npm/-/all/.cache.json'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/YOUR_USERNAME/npm-debug.log
npm ERR! not ok code 0
It whines at you, "Please try running this command again as root/Administrator." So you constantly have to run your node commands as 'sudo' and plug in your password. Sucks right?
There could be a permissions problem on your ~/.npm directory. For users who don't know what'~' means, it's a shorthand for /Users/YOUR_USERNAME/ (the 'home' directory) where the first '/' is your root directory. The full path to your '~/.npm' directory is '/Users/YOUR_USERNAME/.npm'; it stores various npm functionality. The easiest way to get to your home directory on a unix based system is to type 'cd'. This goes to home sweet home. I make this file belong to the user who runs the command and I set the group id to 'admin.'
There could also a permissions problem on your /usr/local/lib/node_modules. This is where npm tries to store your globally installed modules. It is the system level version of the 'node_modules' folder you find in basically any project you make and install with dependencies. I make this file belong to the user running the command; the group id is set to 'admin.''
Usage - Solve Yo Problems, AKA intro was TLDR
Run:
sudo fixmynode
Password:TYPE_YO_PASSWORD
That's it; you're done. That will fix the two permissions problems above and from now on out you should be able to use:
npm install SOME_MODULE
//or
npm install -g SOME_MODULE
without having to type in 'sudo' and your password every time.
The Future
Maybe someone who knows how to work one of the machines called "Windows" can fork me? I doubt this works on a windows system as is. The 'userid' dependency of my module also doesn't work for windows. So you won't be able to set the proper IDs on both folders.
Moral Support
If something goes wrong on your system with node and you need help figuring it out and my package isn't working as intended or at all I'm almost always available on my twitter handle @yvanscher. Hit me up and we'll try and fix your system; I'm no expert but we can probably solve it together.