Search code examples
phpcomposer-phpphar

composer generate [JsonSchema\Exception\ResourceNotFoundException] while executing any command


I am using composer with php 7.1.5 on Windows 10 (x64), I am able to update composer itself if the current folder is empty but as soon as I create composer.json for the project (composer init) then any composer command will fail with the same error. Deleting composer.json will make that error disappear.

[JsonSchema\Exception\ResourceNotFoundException] 
  file_get_contents(phar://Y:/Programs cache/PHP/): 
  failed to open stream: phar error: no directory in "phar://Y:/Programs cache/PHP/", 
  must have at least phar://Y:/Programs cache/PHP// for root directory
  (always use full path to a new phar

Solution

  • I have figured out the issue, I just have a "#" in the paths, I know that this char cause a lot of issues when used in folder names but the problem is that composer worked normally for the update but stopped when I tried composer init