我使用这个composer create-project laravel/laravel --prefer-dist
命令通过git安装了laravel框架。但是我会收到以下错误
Problem 1
- laravel/framework v5.0.4 requires php >=5.4.0 -> no matching package found
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
我的php版本是5.6.3我已经提到了一些与我的问题有关的问题,但没有帮助我。
CMPOSER.JSON
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
答案 0 :(得分:1)
看起来命令行使用旧的PHP版本(5.3.28)。
在LAMP环境中运行whereis php
以查看PHP二进制文件的位置并将其删除。
在Windows中,它有点棘手。您可以手动搜索PHP安装或尝试使用PATH变量计算出来(在控制台中键入PATH
)
然后尝试再次运行php -v
。希望它现在应该使用更新的版本。