laravel - Can't create projects with Composer on Windows 7 -


i'm trying install laravel composer on windows 7 , running error. command i'm running:

composer global require "laravel/installer=~1.1" 

this error get:

file_put_contents(c:\users\myuser\appdata\roaming\composer/vendor/composer/installed.json): failed open stream: no such file or directory 

it's correct installed.json file not exist, there's not composer folder inside vendor folder. not sure why missing. installed composer using windows installer.

seems composer related issue rather laravel. tried installing yii , getting similar error running this:

composer create-project --prefer-dist yiisoft/yii2-app-basic myapp 

for one, after creates folder , seems load files:

file_put_contents(c:\wwwroot\myapp/vendor/composer/installed.json): failed open stream: no such file or directory 

seems problem never have composer folder in vendor folder.

update

i able laravel install globally adding composer_home environment variable. still run similar error when setting laravel project after that

update 2

some additional info, when use windows installer, composer gets installed in c:\programdata\composersetup\bin. if set composer_home environment variable this, laravel can installed globally. trying install project using "laravel new myapp" throws following error:

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 

i suspect that's because have php 5.4 , latest version of laravel 5.6 , above, want install 5.0, 5.4 , above. tried doing using "composer create-project laravel/laravel myapp 5.0 --prefer-dist" instead. following error:

file_put_contents(c:\wwwroot\myapp/vendor/composer/installed.json): failed open stream: no such file or directory 

seems there's weird going on paths can't quite figure out.

update 3

i've uninstalled composer , re-installed manually per instructions provided on composer site. i'm trying create project using following command c:\wwwroot:

composer create-project laravel/laravel c:\wwwroot\myapp --prefer-dist 

it manage install stuff, seems error before package tries install:

installing laravel/laravel (v5.1.4) loading cache failed download laravel/laravel dist: recursivedirectoryiterator::__construct(c:\wwwroot/vendor/composer/,c:\wwwroot/vendor/composer/): system cannot find path specified. (code: 3) 

again, seems can't create directory vendor/composer reason. tried running same command, inside empty c:\wwroot\myapp folder, same result except path in error changes accordingly.

i found following: https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows-

but checked registry , have none of these entries. still no clue.

it seems composer not globally accessible. try add c:\users{username}\appdata\roaming\composer\vendor\bin environment variable restart shell or command-prompt updated path variables loaded. try install laravel again.

here detailed instruction:

  1. go control panel > systems ans security > system > advanced system settings navigate envirinment variables scroll down , locate path add semi colon (;) @ end of path string. means declaring new variable. paste c:\users{username}\appdata\roaming\composer\vendor\bin after (;) have added, restart command prompt , try install laravel again.

Comments