2015-08-29 87 views
0

當我嘗試安裝Composer(exe安裝程序,curl,嘗試所有方法)時,它只安裝在C:\ProgramData\ComposerSetup\bin中,並且從不本地安裝,即使我從另一個目錄運行它(顯然)。Composer僅在全局安裝(Windows 10)

當我運行composer init - 它不會在任何地方創建JSON配置,composer install - 在C:/Users/Username/AppData/Roaming/Composer/

D:\test>composer init 

←[37;44m           ←[39;49m 
←[37;44m Welcome to the Composer config generator ←[39;49m 
←[37;44m           ←[39;49m 


This command will guide you through creating your composer.json config. 

Package name (<vendor>/<name>) [←[33mUsername/test←[39m]: test/test 
Description []: 
Author []: test <[email protected]> 
Minimum Stability []: 
Package Type []: 
License []: 

Define your dependencies. 

Would you like to define your dependencies (require) interactively [←[33myes←[39m]? 
Search for a package: 
Would you like to define your dev dependencies (require-dev) interactively [←[33myes←[39m]? 
Search for a package: 

{ 
    "name": "test/test", 
    "authors": [ 
     { 
      "name": "test", 
      "email": "[email protected]" 
     } 
    ], 
    "require": {} 
} 

D:\test>dir 

29.08.2015 12:39 <DIR>   . 
29.08.2015 12:39 <DIR>   .. 
       0 files 

D:\test>composer require slim/slim -vvv 
Reading ./composer.json 
Loading config file ./composer.json 
Executing command (CWD): git describe --exact-match --tags 
Executing command (CWD): git branch --no-color --no-abbrev -v 
Executing command (CWD): hg branch 
Executing command (CWD): svn info --xml 
Reading C:/Users/Username/AppData/Roaming/Composer/composer.json 
Loading config file C:/Users/Username/AppData/Roaming/Composer/composer.json 
Executing command (CWD): git describe --exact-match --tags 
Executing command (CWD): git branch --no-color --no-abbrev -v 
Executing command (CWD): hg branch 
Executing command (CWD): svn info --xml 
Downloading https://packagist.org/packages.json 
Writing C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2013.json from cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2014.json from cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2014-10.json from cache Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015-01.json from cache Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015-04.json from cache Downloading http://packagist.org/p/provider-2015-07$bf4d7ab35da85686431ee3c47d0d6d2eee3d913013b38506fbc197c5e95c2420.json 
Writing C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015-07.json into cache Downloading http://packagist.org/p/provider-latest$ee6937b535cc76629a8e81c4362790bd14ce6a824def5d75f7222438e756a7b0.json 
Writing C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-latest.json into cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/provider-slim$slim.json from cache Using version ←[32m^2.6←[39m for ←[32mslim/slim←[39m 
←[32m./composer.json has been updated←[39m 
Reading ./composer.json 
Loading config file ./composer.json 
Executing command (CWD): git describe --exact-match --tags 
Executing command (CWD): git branch --no-color --no-abbrev -v 
Executing command (CWD): hg branch 
Executing command (CWD): svn info --xml 
Reading C:/Users/Username/AppData/Roaming/Composer/composer.json 
Loading config file C:/Users/Username/AppData/Roaming/Composer/composer.json 
Executing command (CWD): git describe --exact-match --tags 
Executing command (CWD): git branch --no-color --no-abbrev -v 
Executing command (CWD): hg branch 
Executing command (CWD): svn info --xml 
←[32mLoading composer repositories with package information←[39m 
Downloading https://packagist.org/packages.json 
Writing C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache 
←[32mUpdating dependencies (including require-dev)←[39m 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2013.json from cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2014.json from cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2014-10.json from cache Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015-01.json from cache Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015-04.json from cache Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015-07.json from cache Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/p-provider-latest.json from cache 
Reading C:/Users/Username/AppData/Local/Composer/repo/https---packagist.org/provider-slim$slim.json from cache Analyzed 63 packages to resolve dependencies 
Analyzed 45 rules to resolve dependencies 
    - Installing ←[32mslim/slim←[39m (←[33m2.6.2←[39m) 
Reading C:/Users/Username/AppData/Local/Composer/files/slim/slim/20a02782f76830b67ae56a5c08eb1f563c351a37.zip from cache 
    Loading from cache 
    Extracting archive 

    REASON: Required by root: Install command rule (install slim/slim 2.6.0|install slim/slim 2.6.1|install slim/slim 2.6.2) 

←[32mWriting lock file←[39m 
←[32mGenerating autoload files←[39m 

任何想法只安裝如何解決呢?

回答

0

在應用所有步驟之前,請嘗試使用當前設置執行步驟5。

安裝步驟

  1. 手動下載:https://getcomposer.org/composer.phar
  2. 地方composer.phar到PHP文件夾,旁邊php.exe
  3. 在同一個文件夾中添加一個批處理文件composer.bat(執行作曲家容易一點) ,內容如下:

    @echo off 
    :: Composer CLI Shortcut (Global Installation) 
    "%~dp0php.exe" "%~dp0composer.phar" %* 
    pause 
    
  4. 添加PHP文件夾到您ENV通道,使phpcomposer任何可用的路徑上

  5. 然後創建新項目
    • mkdir slim
    • cd slim
    • composer require slim/slim 2.6.2 -vvv(這一次的版本)