简体   繁体   中英

how to fix $PATH in Virtual Box Ubuntu 14.04 after npm global install

I've been trying to install npm globally in virtual box with ubuntu 14.04 and Apache 2.4 with various problems with Laravel 5.1

Reading through the docs on npm adn following through these instructions https://docs.npmjs.com/getting-started/fixing-npm-permissions I know I have completed wrecked my $PATH

Previously when I ran echo $PATH I got something like this;

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games

Now when I echo $PATH I get the following;

/usr/local/bin:/bin

I have managed to stuff everything up on my Laravel install, composer no longer works, php artisan no longer works - am just wondering if anyone is able to help me get back to where I was...

For the novices who may be struggling with this, I got the path, composer, artisan and Laravel functioning by first, replacing the .bashrc with a non corrupt one in terminal from the /etc/skel directory (in local indicated by $)

$cp /etc/skel/.bashrc ~/

Commit changes with

$source ~/.bashrc

Then used the following to export /usr/bin to my PATH - the error for anything attempted in terminal was "The command could not be located because '/usr/bin' is not included in the PATH"

$export PATH="/usr/bin:$PATH"

To permanently commit the changes

$sudo nano /etc/environment

Check the file contains the following

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

CTRL & X to save and Y

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM