title: Can't create projects with Composer on Windows 7
body: <p>I'm trying to install Laravel with composer on Windows 7 and am running into an error. This is the command I'm running:</p>
  
  <pre><code>composer global require "laravel/installer=~1.1"
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>file_put_contents(C:\Users\myUser\AppData\Roaming\Composer/vendor/composer/installed.json): failed to open stream: No such file or directory
  </code></pre>
  
  <p>It's correct to say that the installed.json file does not exist, there's not even a composer folder inside the vendor folder. Not sure why that would be missing. I installed composer using the Windows installer.</p>
  
  <p>Seems to be a composer related issue rather than laravel. I just tried installing yii and am getting a similar error running this:</p>
  
  <pre><code>composer create-project --prefer-dist yiisoft/yii2-app-basic MyApp
  </code></pre>
  
  <p>For this one, I get this after it successfully creates the folder and seems to load most files:</p>
  
  <pre><code>file_put_contents(C:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
  </code></pre>
  
  <p>Seems like the problem is that I never have a composer folder in my vendor folder.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I was able to get laravel to install globally by adding the COMPOSER_HOME environment variable. But I still run into a similar error when setting up a Laravel project after that</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Some additional info, when I use the Windows Installer, composer gets installed in c:\ProgramData\ComposerSetup\bin. If I set the COMPOSER_HOME environment variable to this, laravel can get installed globally. But trying to install a project using the "laravel new MyApp" throws the following error:</p>
  
  <pre><code>Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wwwroot\MyApp\artisan on line 31
  </code></pre>
  
  <p>I suspect that's because I have PHP 5.4 and the latest version of laravel is 5.6 and above, but I want to install 5.0, which is 5.4 and above. I tried doing it using "composer create-project laravel/laravel MyApp 5.0 --prefer-dist" instead. I get the following error:</p>
  
  <pre><code>file_put_contents(c:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
  </code></pre>
  
  <p>Seems there's just something weird going on with paths that I can't quite figure out.</p>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>I've now uninstalled composer and re-installed it manually per the instructions provided on the composer site. I'm now trying to create a project using the following command from c:\wwwroot:</p>
  
  <pre><code>composer create-project laravel/laravel c:\wwwroot\MyApp --prefer-dist
  </code></pre>
  
  <p>It does manage to install some stuff, but seems I get this error before any package it tries to install:</p>
  
  <pre><code>Installing laravel/laravel (v5.1.4)
  Loading from cache
  Failed to download laravel/laravel from dist: RecursiveDirectoryIterator::__construct(C:\wwwroot/vendor/composer/,C:\wwwroot/vendor/composer/): The system cannot find the path specified. (code: 3)
  </code></pre>
  
  <p>Again, seems like it can't create a directory for vendor/composer for some reason. I tried running the same command, but from inside an empty c:\wwroot\MyApp folder, same result except the path in the error changes accordingly.</p>
  
  <p>I found the following: <a href="https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows-" rel="nofollow">https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows-</a></p>
  
  <p>But I checked my registry and I have none of these entries. So still no clue.</p>