Laravel

Laravel安装过程中遇到的几个问题

1.安装Homestead的过程中,在输入cd~/Homestead&&vagrant up后

There was an error while executing `VBoxManage`, a CLI used by Vagrantfor controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "152cca03-0b0a-4e57-b501-b694821a2629", "--type", "headless"]

Stderr: VBoxManage.exe: error: The virtual machine 'homestead-7' has terminated unexpectedly during startup with exit code -1073741819 (0xc0000005).

解决方法:这种情况是vagrant 启动失败,一般是VirtualBox出问题。先试下能否在VirtualBox中启动其他虚拟机,如果不能就重装VirtualBox


2.在将 SSH Key 添加到 ssh-agent 中时,输入

$eval`ssh-agent -s`

$ ssh-add ~/.ssh/id_rsa

遇到Could not open a connection to your authentication agent

解决方法:先运行exec ssh-agent bash再eval ssh-agent -s最后ssh-add ~/.ssh/id_rsa


3.将公钥添加到 GitHub 账号,输入$ sudo apt-get install xclip  $ xclip -sel clip < ~/.ssh/id_rsa.pub来复制公钥后遇到Can't open display: (null)

可以试一下 $DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub 来复制。如果还是无法复制,可以$cat ~/.ssh/id_rsa.pub将公钥输出,手动复制


4.第一次将生成的laravel文件推送到github前($gitremote add [email protected]:your_username/your_projectname.git

$gitpush -u origin master),要确保先$git init  $git add -A  $gitcommit -m"Initial commit" 将文件在虚拟机中保存,不然会出现not a git repository的情况


5.linux 下执行 php artisan help:commands 命令,提示 Could not open input file: artisan 错误

artisan 是 Laravel 项目下的指令文件,在Laravel 项目的根目录下可以看到artisan文件。所以首先要建立 Laravel 项目。如果已经建立项目需要CD到项目的目录下执行 artisan 命令。

6.在我们每次对homestead.yaml文件进行了更改之后,都需要运行下面命令来使其更改生效:cd~/Homestead&&vagrant provision

但是这个命令是在homestead下运行的,不能在vagrant运行

使用homestead执行yarn add jquery --save命令报错

如果你正在 Windows 系统上开发,需要在运行yarn add jquery --save命令时带上--no-bin-links:

即yarnadd jquery --save --no-bin-links

你可能感兴趣的:(Laravel)