[英]Unable to include “vendor/autoload.php” after installing Composer on Ubuntu
I'm just getting familiar with Linux servers and I'm trying to install Composer on my Ubuntu server. 我刚刚熟悉Linux服务器,我正在尝试在我的Ubuntu服务器上安装Composer。 I think everything installed correctly except when I try to include Composer's autoloader I get a PHP error:
我认为一切都正确安装,除非我尝试包含Composer的自动加载器我得到一个PHP错误:
Warning: require(/usr/share/php/opencloud/lib/../vendor/autoload.php): failed to open stream: No such file or directory in /usr/share/php/opencloud/lib/php-opencloud.php on line 5 Fatal error: require(): Failed opening required '/usr/share/php/opencloud/lib/../vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/php/opencloud/lib/php-opencloud.php on line 5
My composer.json is: 我的composer.json是:
{
"require": {
"rackspace/php-opencloud": "v1.7.0"
}
}
And when I run "composer diag" it outputs this: 当我运行“composer diag”时,它会输出:
Checking composer.json: FAIL
name : is missing and it is required
description : is missing and it is required
This is an existing bug with Composer on WINDOWS (for me, at least). 这是WINDOWS上Composer的一个现有错误(至少对我而言)。 Manual install style Composer.
手动安装样式Composer。
vendor/autoload.php is not created nor is any other autoload-related content. vendor / autoload.php未创建,也不是任何其他与自动加载相关的内容。
I try the same exact thing on Linux AND Windows (except for the platform-specific different options in the batch commands) for running Composer and installing/setting up rackspace using composer install & composer-rackspace require batch line. 我在Linux和Windows上尝试相同的事情(批处理命令中除了特定于平台的不同选项),以便运行Composer并使用composer install和composer-rackspace需要批处理行来安装/设置rackspace。 I get 2 different results.
我得到2个不同的结果。 Autoload-related stuff is created on linux just fine.
与autoload相关的东西在linux上创建就好了。 No autoload related stuff is created for Windows.
没有为Windows创建与自动加载相关的内容。
Guess Windows Composer needs more work/fixing. 猜猜Windows Composer需要更多工作/修复。 :(
:(
This in general seems to be working on Linux/Ubuntu for me so far, I'll let you know if I get any problems. 到目前为止,这对我来说似乎一直在Linux / Ubuntu上运行,如果我遇到任何问题,我会告诉你的。
The warning seems to be pretty clear, it can't find autoload.php file. 警告似乎很清楚,它找不到autoload.php文件。 I guess some path problem in your require:
我想你的要求中有一些路径问题:
require 'vendor/autoload.php';
About the missing data you could solve adding it in your composer.json 关于丢失的数据,您可以在composer.json中添加它
{
"name":"YOURNAME",
"description":"YOUR DESCRIPTION",
"require":{
"rackspace/php-opencloud": "v1.7.0"
}
}
For anyone using windows. 对于任何使用Windows的人。 I just had the same problem on Windows, it did not download all the files on "composer install".
我在Windows上遇到了同样的问题,它没有下载“composer install”上的所有文件。 But after I ran "composer update" all the files including the vendor/autoload.php were download/generated
但是在我运行“composer update”之后,下载/生成了包括vendor / autoload.php在内的所有文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.