简体   繁体   English

如何在npm全局安装后修复Virtual Box Ubuntu 14.04中的$ PATH

[英]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 我一直在尝试使用ubuntu 14.04和Apache 2.4在虚拟框中全局安装npm,但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 按照以下说明通读npm adn上的文档https://docs.npmjs.com/getting-started/fixing-npm-permissions我知道我已经破坏了我的$ PATH

Previously when I ran echo $PATH I got something like this; 以前,当我运行echo $ PATH时,我得到了类似的内容;

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

Now when I echo $PATH I get the following; 现在,当我回显$ PATH时,我得到以下内容:

/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... 我设法在Laravel安装中填满了所有内容,composer不再起作用,php artisan不再起作用-我只是想知道是否有人能够帮助我回到原来的位置...

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 $) 对于可能为此感到苦恼的新手,我首先得到了路径,作曲家,工匠和Laravel的作用,在/ etc / skel目录中的终端中用未损坏的.bashrc替换了.bashrc(在$表示的本地)

$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" 然后使用以下命令将/ usr / bin导出到我的PATH-在终端中尝试执行的任何操作的错误是“由于PATH中不包含'/ usr / bin',因此无法找到命令”

$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 CTRL&X保存,Y

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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