installing laravel dependencies with composer not

2019-09-01 07:55发布

I'm trying to install Laravel Excel using this guide

I have included the line in my composer.json;

"require": {
    "laravel/framework": "4.2.*",
    "maatwebsite/excel": "1.*"
},

I am then attempting to update composer using the command composer update. This results in the following messages....

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.

Loading composer repositories with package information

The "https://packagist.org/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Name or service not known

failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

Updating dependencies (including require-dev)

[Composer\Downloader\TransportException]
The "http://packagist.org/p/jeremeamia/functionparser$cac3105ac0ad3f9a0f9c9ccabcde36787c8d8f404a003fa47900f84cee475a34.json" file could not be downloaded: php_

network_getaddresses: getaddrinfo failed: Name or service not known
  failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]

When I try to self-update composer (as recommended in the warning message) I get the following;

[Composer\Downloader\TransportException]
  The "https://getcomposer.org/version" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Name or service not known
  failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

So my first problem is that I cannot update composer.

My second problem is that I do not think Laravel Excel has been installed because I cannot see it in the vendor/laravel directory anywhere (isn't that where all the dependencies are usually stored?)

I am a complete beginner when it comes to using composer and installing dependencies and I've not really even used a JSON file before until now so really struggling here...

2条回答
时光不老,我们不散
2楼-- · 2019-09-01 08:22

I had faced the same problem. Later, I came to know that my proxy not allowing me to update the composer. So, check your proxy settings.

查看更多
混吃等死
3楼-- · 2019-09-01 08:36

For Linux users (Centos 6,7) Check your name servers that you have in /etc/resolv.conf working properly with the below command

nslookup www.google.com

If it is not working used the google public name server at 8.8.8.8 and 8.8.4.4

nameserver 8.8.8.8
nameserver 8.8.4.4
查看更多
登录 后发表回答