im rookie on composer. these are my scenario:
- composer installed with administrative permissions without problem in windows 10.
- composer v1.10.6 was setup on PHP version 5.6.40
- composer is running under cygwin64 terminal
- on cygdrive: 'cd c:/wamp64/www/dev0'
- on cygdrive: 'composer create-project laravel/laravel test0 --prefer -dist'
get error: [RuntimeException] Invalid working directory specified, does not exist.
need help to assign working directory to composer on windows 10
Related
Already installed composer to 'C:/xampp/htdocs/crud' with cmd. However trying to install laravel via the 'composer create-project --prefer-dist laravel/laravel blog' command does not download or install anything. The 'composer global require laravel/installer' command produces the same result.
PS: don't know if it wrecks anything but, I was having trouble running the composer command at first, kept saying there is no app to open '.phar' files. I found an answer here that asked me run .phar files with php.exe by default and thats what i did.
A picture to show what happens when I run the composer commands to install laravel...
I'm on Debian and my PHP version is 7.0.27.
First I began installing Composer using curl -sS https://getcomposer.org/installer | php and then sudo mv composer.phar /usr/local/composer (sudo because that's outside of my home directory). Then I typed composer and it executed correctly.
Then I launched my XAMPP Apache server and I went to the /opt/lampp/htdocs folder. There I typed the command sudo composer create-project laravel/laravel myproject (again, sudo because that's outside of my home directory, but it throwed an alert : "Do not run Composer as root/super user! See https://getcomposer.org/root for details").
But then I got this error :
Your requirements could not be resolved to an installable set of packages.
and it printed a bunch of problems.
What did I do wrong?
Thank you for your help.
EDIT1: I must specify that the myproject folder was created nonetheless, but when I got to http://localhost/myproject/public it printed a PHP error :
Warning: require(/opt/lampp/htdocs/myproject/public/../vendor/autoload.php): failed to open stream: Aucun fichier ou dossier de ce type in /opt/lampp/htdocs/myproject/public/index.php on line 24
Fatal error: require(): Failed opening required '/opt/lampp/htdocs/myproject/public/../vendor/autoload.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/myproject/public/index.php on line 24
Laravel provides a list of what php extensions it requires for each version.
https://laravel.com/docs/5.6#server-requirements
Those are for the last version.
According to your error you are missing php-mbstring
I'm trying to install Laravel with composer on Windows 7 and am running into an error. This is the command I'm running:
composer global require "laravel/installer=~1.1"
This is the error I get:
file_put_contents(C:\Users\myUser\AppData\Roaming\Composer/vendor/composer/installed.json): failed to open stream: No such file or directory
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.
Seems to be a composer related issue rather than laravel. I just tried installing yii and am getting a similar error running this:
composer create-project --prefer-dist yiisoft/yii2-app-basic MyApp
For this one, I get this after it successfully creates the folder and seems to load most files:
file_put_contents(C:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
Seems like the problem is that I never have a composer folder in my vendor folder.
UPDATE
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
UPDATE 2
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:
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 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:
file_put_contents(c:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
Seems there's just something weird going on with paths that I can't quite figure out.
UPDATE 3
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:
composer create-project laravel/laravel c:\wwwroot\MyApp --prefer-dist
It does manage to install some stuff, but seems I get this error before any package it tries to install:
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)
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.
I found the following: https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows-
But I checked my registry and I have none of these entries. So still no clue.
It seems that your composer is not globally accessible. Try to add C:\Users{UserName}\AppData\Roaming\Composer\vendor\bin to your environment variable then restart your Shell or Command-Prompt so that updated Path variables is loaded. Now try to install laravel again.
Here is the detailed instruction:
Go to Control Panel > Systems ans Security > System > Advanced system settings then navigate to envirinment variables then scroll down and locate the PATH then add a semi colon (;) at the end of the PATH string. This means you are declaring a new variable. Then paste the C:\Users{UserName}\AppData\Roaming\Composer\vendor\bin after (;) you have added, restart the command prompt and try to install laravel again.
Uninstall composer and install it again, but this time do enable shell menu. Right click on the location (directory) where you want to create the project, select "use composer here", then "composer create-project laravel/laravel projectName --prefer-dist" should create your laravel project, default to latest version (5.1).
To specify your prefer version:
"composer create-project laravel/laravel 4.2 projectName --prefer-dist"
I will suggest you to install Homestead (http://blog.teamtreehouse.com/laravel-homestead-on-windows) and do all the heavylifting there.
You just need to do homestead ssh to actually connect to your machine and then perform all your operations.
Windows is pretty unpredictable in that kind of situations and in web development in general.
Help guys in installing Laravel 5,
I'm using Windows 7 Home premium
I'm using the Git bash as my terminal
I run the command
composer global require "laravel/installer=~1.1"
And it successfully installed
But when I ran
laravel new blog
It shows the message below:
Crafting application...
'composer' is not recognized as an internal or external command, operable program or batch file.
Application ready! Build something amazing.
There's an error message "'composer' is not recognized....".
Why is this happening to me?
The composer command is working fine. :(
I've already added the path ";C:\Users\username\AppData\Roaming\Composer\vendor\bin" to my system variables
Run command install Laravel:
composer create-project laravel/laravel --prefer-dist
http://laravel.com/docs/5.0/installation
Solved! Tried to reinstall it at my office.
It seems that my internet connection at home blocks some websites and running this command
composer global require "laravel/installer=~1.1"
installed incomplete laravel installer.
I am using windows 8 .I am using XAMPP.I installed XAMPP in D drive. My web root path is D:\php\htdocs. Location of php.exe file is D:\php\php. I would like to install Composer first then Laravel using composer. Could any one show me the whole process with step by step instruction ??
Add Php installation path to Environment Variable.
Cd to D:\xampp\php [Php Installation path]
Install composer using, php -r "readfile('https://getcomposer.org/installer');" | php
Create composer.bat file, using D:\xampp\php>echo #php "%~dp0composer.phar" %*>composer.bat
Check the installation using composer -V.
If it works fine, install laravel using the following command. composer create-project laravel/laravel myapp --prefer-dist
Download and run the Composer Windows Installer from here: https://getcomposer.org/download/
Go to web root directory D:\php\htdocs
Run composer create-project laravel/laravel myapp, this will install laravel project in D:\php\htdocs\myapp directory.