1、安装laravel时报错
[root@localhost www]# composer create-project laravel/laravel --prefer-dist XeShop
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Installing laravel/laravel (v5.5.28)
- Installing laravel/laravel (v5.5.28): Loading from cache
Created project in XeShop
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/thanks v1.0.1 requires php ^5.5.9|^7.0.8 -> your PHP version (7.0.1) does not satisfy that requirement.
- symfony/thanks v1.0.0 requires php ^5.5.9|^7.0.8 -> your PHP version (7.0.1) does not satisfy that requirement.
- Installation request for symfony/thanks ^1.0 -> satisfiable by symfony/thanks[v1.0.0, v1.0.1].
2、一开始楼主以为是版本的问题,于是看了看composer中都有什么版本
[root@localhost bin]# composer info laravel/laravel
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Composer could not find a composer.json file in /usr/local/bin
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
3、发现没有composer.json,于是新建一个,写入内容
{
"require": {
"laravel/laravel": "5.5.*"
}
}
4、再次测试还是不行
[root@localhost bin]# composer info laravel/laravel
Do not run Composer as root/super user! See https://getcomposer.org/root for details
No dependencies installed. Try running composer install or update.
[InvalidArgumentException]
Package laravel/laravel not found
show [--all] [-i|--installed] [-p|--platform] [-a|--available] [-s|--self] [-N|--name-only] [-P|--path] [-t|--tree] [-l|--latest] [-o|--outdated] [-m|--minor-only] [-D|--direct] [--strict] [-f|--format FORMAT] [--] [<package>] [<version>]
5、原来楼主没有安装,就安装一下
[root@localhost bin]# composer install
6、就可以了
[root@localhost bin]# composer info -a laravel/laravel
Do not run Composer as root/super user! See https://getcomposer.org/root for details
name : laravel/laravel
descrip. : The Laravel Framework.
keywords : framework, laravel
versions : dev-master, v5.5.28, v5.5.22, v5.5.0, 5.4.x-dev, v5.4.30, v5.4.23, v5.4.21, v5.4.19, v5.4.16, v5.4.15, v5.4.9, v5.4.3, v5.4.0, 5.3.x-dev, v5.3.30, v5.3.16, v5.3.10, v5.3.0, 5.2.x-dev, v5.2.31, v5.2.29, v5.2.27, v5.2.24, v5.2.23, v5.2.15, v5.2.0, 5.1.x-dev, v5.1.33, v5.1.11, v5.1.4, v5.1.3, v5.1.1, v5.1.0, 5.0.x-dev, v5.0.22, v5.0.16, v5.0.1, v5.0.0, v4.2.11, v4.2.0, v4.1.27, v4.1.18, v4.1.0, v4.0.9, v4.0.8, v4.0.7, v4.0.6, v4.0.5, v4.0.4, v4.0.0, v4.0.0-BETA4, v4.0.0-BETA3, dev-develop
7、然后我又试了一次安装laravel,结果竟然成功了,不过楼主也不知道为什么?若有大神可以指教一下
[root@localhost www]# composer create-project --prefer-dist laravel/laravel XeShop