PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/composer/composer/doc/articles/troubleshooting.md

https://gitlab.com/yousafsyed/easternglamor
Markdown | 159 lines | 111 code | 48 blank | 0 comment | 0 complexity | f6f9dd62ae0fe8e1bc94a7433d2f7065 MD5 | raw file
  1. <!--
  2. tagline: Solving problems
  3. -->
  4. # Troubleshooting
  5. This is a list of common pitfalls on using Composer, and how to avoid them.
  6. ## General
  7. 1. Before asking anyone, run [`composer diagnose`](../03-cli.md#diagnose) to check
  8. for common problems. If it all checks out, proceed to the next steps.
  9. 2. When facing any kind of problems using Composer, be sure to **work with the
  10. latest version**. See [self-update](../03-cli.md#self-update) for details.
  11. 3. Make sure you have no problems with your setup by running the installer's
  12. checks via `curl -sS https://getcomposer.org/installer | php -- --check`.
  13. 4. Ensure you're **installing vendors straight from your `composer.json`** via
  14. `rm -rf vendor && composer update -v` when troubleshooting, excluding any
  15. possible interferences with existing vendor installations or `composer.lock`
  16. entries.
  17. 5. Try clearing Composer's cache by running `composer clear-cache`.
  18. ## Package not found
  19. 1. Double-check you **don't have typos** in your `composer.json` or repository
  20. branches and tag names.
  21. 2. Be sure to **set the right
  22. [minimum-stability](../04-schema.md#minimum-stability)**. To get started or be
  23. sure this is no issue, set `minimum-stability` to "dev".
  24. 3. Packages **not coming from [Packagist](https://packagist.org/)** should
  25. always be **defined in the root package** (the package depending on all
  26. vendors).
  27. 4. Use the **same vendor and package name** throughout all branches and tags of
  28. your repository, especially when maintaining a third party fork and using
  29. `replace`.
  30. 5. If you are updating to a recently published version of a package, be aware that
  31. Packagist has a delay of up to 1 minute before new packages are visible to Composer.
  32. ## Package not found on travis-ci.org
  33. 1. Check the ["Package not found"](#package-not-found) item above.
  34. 2. If the package tested is a dependency of one of its dependencies (cyclic
  35. dependency), the problem might be that composer is not able to detect the version
  36. of the package properly. If it is a git clone it is generally alright and Composer
  37. will detect the version of the current branch, but travis does shallow clones so
  38. that process can fail when testing pull requests and feature branches in general.
  39. The best solution is to define the version you are on via an environment variable
  40. called COMPOSER_ROOT_VERSION. You set it to `dev-master` for example to define
  41. the root package's version as `dev-master`.
  42. Use: `before_script: COMPOSER_ROOT_VERSION=dev-master composer install` to export
  43. the variable for the call to composer.
  44. ## Need to override a package version
  45. Let say your project depends on package A which in turn depends on a specific
  46. version of package B (say 0.1) and you need a different version of that
  47. package - version 0.11.
  48. You can fix this by aliasing version 0.11 to 0.1:
  49. composer.json:
  50. ```json
  51. {
  52. "require": {
  53. "A": "0.2",
  54. "B": "0.11 as 0.1"
  55. }
  56. }
  57. ```
  58. See [aliases](aliases.md) for more information.
  59. ## Memory limit errors
  60. If composer shows memory errors on some commands:
  61. `PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>`
  62. The PHP `memory_limit` should be increased.
  63. > **Note:** Composer internally increases the `memory_limit` to `512M`.
  64. > If you have memory issues when using composer, please consider [creating
  65. > an issue ticket](https://github.com/composer/composer/issues) so we can look into it.
  66. To get the current `memory_limit` value, run:
  67. ```sh
  68. php -r "echo ini_get('memory_limit').PHP_EOL;"
  69. ```
  70. Try increasing the limit in your `php.ini` file (ex. `/etc/php5/cli/php.ini` for
  71. Debian-like systems):
  72. ```ini
  73. ; Use -1 for unlimited or define an explicit value like 512M
  74. memory_limit = -1
  75. ```
  76. Or, you can increase the limit with a command-line argument:
  77. ```sh
  78. php -d memory_limit=-1 composer.phar <...>
  79. ```
  80. ## "The system cannot find the path specified" (Windows)
  81. 1. Open regedit.
  82. 2. Search for an `AutoRun` key inside `HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor`,
  83. `HKEY_CURRENT_USER\Software\Microsoft\Command Processor`
  84. or `HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Command Processor`.
  85. 3. Check if it contains any path to non-existent file, if it's the case, just remove them.
  86. ## API rate limit and OAuth tokens
  87. Because of GitHub's rate limits on their API it can happen that Composer prompts
  88. for authentication asking your username and password so it can go ahead with its work.
  89. If you would prefer not to provide your GitHub credentials to Composer you can
  90. manually create a token using the following procedure:
  91. 1. [Create](https://github.com/settings/applications) an OAuth token on GitHub.
  92. [Read more](https://github.com/blog/1509-personal-api-tokens) on this.
  93. 2. Add it to the configuration running `composer config -g github-oauth.github.com <oauthtoken>`
  94. Now Composer should install/update without asking for authentication.
  95. ## proc_open(): fork failed errors
  96. If composer shows proc_open() fork failed on some commands:
  97. `PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar`
  98. This could be happening because the VPS runs out of memory and has no Swap space enabled.
  99. ```sh
  100. free -m
  101. total used free shared buffers cached
  102. Mem: 2048 357 1690 0 0 237
  103. -/+ buffers/cache: 119 1928
  104. Swap: 0 0 0
  105. ```
  106. To enable the swap you can use for example:
  107. ```sh
  108. /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
  109. /sbin/mkswap /var/swap.1
  110. /sbin/swapon /var/swap.1
  111. ```