Unable to include “vendor/autoload.php” after inst

2019-08-31 07:03发布

I'm just getting familiar with Linux servers and I'm trying to install Composer on my Ubuntu server. I think everything installed correctly except when I try to include Composer's autoloader I get a PHP error:

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:

{
    "require": {
        "rackspace/php-opencloud": "v1.7.0"
    }
}

And when I run "composer diag" it outputs this:

Checking composer.json: FAIL
name : is missing and it is required
description : is missing and it is required

3条回答
看我几分像从前
2楼-- · 2019-08-31 07:33

The warning seems to be pretty clear, it can't find autoload.php file. 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

{
    "name":"YOURNAME",
    "description":"YOUR DESCRIPTION",
    "require":{
        "rackspace/php-opencloud": "v1.7.0" 
    }
}
查看更多
We Are One
3楼-- · 2019-08-31 07:44

This is an existing bug with Composer on WINDOWS (for me, at least). Manual install style Composer.

vendor/autoload.php is not created nor is any other autoload-related content.

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. I get 2 different results. Autoload-related stuff is created on linux just fine. No autoload related stuff is created for Windows.

Guess Windows Composer needs more work/fixing. :(

This in general seems to be working on Linux/Ubuntu for me so far, I'll let you know if I get any problems.

查看更多
倾城 Initia
4楼-- · 2019-08-31 07:52

For anyone using windows. I just had the same problem on Windows, it did not download all the files on "composer install". But after I ran "composer update" all the files including the vendor/autoload.php were download/generated

查看更多
登录 后发表回答