Issue with ~/.profile after fixing NPM permissions

571 Views Asked by At

Installed Node.js on OS X. Fixed the permissions (i.e. sudo required) issue by changing NPM's default directory (https://docs.npmjs.com/getting-started/fixing-npm-permissions see Option 2). However, after booting up commands like grunt are not available until I run source ~/.profile.

Any way to avoid this hassle?

1

There are 1 best solutions below

1
On BEST ANSWER

Did the node/NPM setup create a ~/.bash_profile or ~/.bash_login file? if so, bash will source that instead of ~/.profile at startup. If this is the problem, there are a couple of ways to fix it:

  • Copy the contents of your ~/.profile file into ~/.bash_profile (or ~/.bash_login). You may also want to delete ~/.profile to avoid future confusion.

  • Add a command to ~/.bash_profile (or ~/.bash_login) to source ~/.profile as well:

    [ -f ~/.profile ] && source ~/.profile