0

spent a lot of time today trying to solve a problem with global installs from my node package manager.

I would try something like

npm install -g npm

And see no changes reflected in my npm version number. Or

npm install -g firebase-tools

And see bash: command not found in my terminal after immediately attempting

firebase

I spent hours tinkering with my $PATH, deleting and reinstalling node with brew, and eventually came upon my answer in this post from Trevor Burnham.

Now that my path prefix is /usr/local , globally installed packages are working properly. Though I am not entirely sure why... Before my path prefix was empty and I was still able to work with global npm packages. I understand that brew is installing to the /usr/local directory, but for example, why do we not include /bin/?

Finding this solution my path was mired with small posts like this one suggesting to chmod 777 the usr/local directory and it struck me that a lot of people have struggled on this with spotty guidance.

Hoping some kind, seasoned soul will help me figure out how to logically determine the proper directory for

npm config set prefix ...

/ how to identify these kinds of problems quicker maybe, or what other factors are involved, say, whether or not we used brew to install node and how that effects the global path?

Thanks for any clarity you can offer!

Community
  • 1
  • 1
Daniel Thompson
  • 2,193
  • 4
  • 23
  • 37
  • `chmod 777` -> nonononono! Never ever run `chmod 777`. It is practically never required! Not even for "testing purposes". If the file is readable, then it's readable. If it's writable by the `user` or `group` that need to write to it, then it's writable. There is absolutely zero need to give everyone write permissions, and forgetting to `chmod` it back to something sane is exactly how multinationals get hacked. Just don't do it. Ever. I wrote [an introduction of Unix permissions](http://stackoverflow.com/a/35895436/660921). Please read it! – Martin Tournoij Mar 13 '16 at 04:16
  • Wow thanks for the thoughtful comment. Is there any way to search for all directories with currently with 777 permissions so that I can undo any damage? – Daniel Thompson Mar 15 '16 at 18:36

0 Answers0