douju1852 2014-06-25 17:31
浏览 56
已采纳

安装Zend Framework 2 Skeleton应用程序时的Composer异常

I am trying to setup a Zendframework 2.3 application on my MAMP server running MAMP pro 3.0. I am using the instructions on TemplateStock (http://www.templatestock.net/install-zend-framework-2-on-mac-osx-and-mamp/). Installing composer is successful:

/Applications/MAMP$ curl -s https://getcomposer.org/installer | php -d detect_unicode=off #!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /Applications/MAMP/composer.phar
Use it: php composer.phar

Then I try to run the following to install the skeleton project:

php composer.phar create-project -sdev --repository-url="https://packages.zendframework.com" zendframework/skeleton-application /Applications/MAMP/htdocs/MyApp

and I get the following output:

Installing zendframework/skeleton-application (dev-master 67cbbbf61897831ef1feda323be9845aa7d79682)
  - Installing zendframework/skeleton-application (dev-master master)
    Cloning master

 Created project in /Applications/MAMP/htdocs/myApp/



  [InvalidArgumentException]                                                                                                         
  Composer could not find the config file: /Users/shill/.composer/vendor/bin                                                         
  To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section  



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [package] [directory] [version]

Running `php composer.phar diag' returns OK for everything.

The composer.json file in the myApp directory is as follows:

{
  "name": "zendframework/skeleton-application",
  "description": "Skeleton Application for ZF2",
  "license": "BSD-3-Clause",
  "keywords": [
      "framework",
      "zf2"
  ],
  "homepage": "http://framework.zend.com/",
  "require": {
      "php": ">=5.3.3",
      "zendframework/zendframework": "2.3.*"
  }
}

Resolved...Need Super User Permission

sudo php composer.phar install
  • 写回答

1条回答 默认 最新

  • douzhuo6931 2014-06-25 20:43
    关注

    You got into troubles by using composer at a certain moment with sudo rights. Now you got the /Users/shill/.composer.json/ directory owned by root. This caused a failure in the installation of a single project.

    You "fixed" this by using sudo for installation of the project itself too. This is not a fix, it just enlarges your problem. What you need to do is to chown all those files to yourself again.

    Assumed you're user name is shill:

    chmod -R shill:shill /Users/shill/.composer.json
    chmod -R shill:shill /Applications/MAMP/htdocs/myApp
    

    Make sure the web server / php worker is able to read files in your myApp directory, but that shouldn't really be difficult.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3