安装laravel依赖项与composer无法正常工作

时间:2015-02-06 13:17:55

标签: json laravel dependencies composer-php

我正在尝试使用this guide

安装Laravel Excel

我已将该行包含在我的composer.json;

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

然后我尝试使用命令composer update更新composer。这导致以下消息....

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]

当我尝试自我更新作曲家时(根据警告信息中的建议),我得到以下内容;

[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

所以我的第一个问题是我无法更新作曲家。

我的第二个问题是我不认为Laravel Excel已经安装,因为我无法在vendor / laravel目录中看到它(不是通常存储所有依赖项的地方吗?)

在使用composer和安装依赖项方面,我是一个完全的初学者,直到现在我还没有真正使用过JSON文件,所以真的在这里挣扎......

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。后来,我才知道我的代理不允许我更新作曲家。因此,请检查您的代理设置。

答案 1 :(得分:0)

对于Linux用户(Centos 6,7) 使用以下命令检查/etc/resolv.conf中的名称服务器是否正常工作

nslookup www.google.com

如果无效,请使用8.8.8.8和8.8.4.4的Google公共名称服务器

nameserver 8.8.8.8
nameserver 8.8.4.4