Okay. I don't just copy-paste commands from the net, and I didn't see how/why that one would mess things up, but here....
I wanted to configure webstorm for dev. So I followed these instructions:
$ mkdir ~/.npm-global # directory where npm will install packages
$ npm config set prefix '~/.npm-global' # configure npm
$ echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile #add directory to path
$ source ~/.profile # refresh path for current session
Now if I enter most commands, I get this:
anonymous@anonymous:/home$ sudo nano ~/.profile
Command 'sudo' is available in '/usr/bin/sudo'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
sudo: command not found
I don't see how/why this should break pretty much all my commands. Did he override whatever was in PATH, instead of appending? How do I fix this?
Yes it looks like he did, here's my echo $PATH:
anonymous@anonymous:/home$ echo $PATH
/home/anonymous/.npm-global
Content of ~/.profile
:
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH=~/.npm-global
~/.profile
, especially the lines containing PATH. – Soren A Nov 05 '18 at 14:56