I am new in Php
and start working on laravel
based project but facing one issue when installing composer
on project level (I am using Phpstrom
Ide).
composer install –no-interaction –ansi Loading composer
repositories with package information Installing dependencies
(including require-dev) from lock file Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize Script php artisan optimize handling the post-install-cmd event returned with error code 1 Failed to install
packages for ./composer.json.
Process :-
- Install composer and wamp server
- Hit this command in order to create laravel project
composer create-project laravel/laravel –prefer-dist
and project is created with this error and no vendor folder is created
Installing laravel/laravel (v5.4.30)
– Installing laravel/laravel (v5.4.30): Downloading (100%) Created project in C:\wamp64\www\laravelphp -r "file_exists('.env') || copy('.env.example', '.env');" Script php -r "file_exists('.env') || copy('.env.example', '.env');" handling
th e post-root-package-install event returned with error code 1
- I hit the composer command for Install and get first issue in this post
Composer -v
PHP temp directory (D:\mysql\temp) does not exist or is not writable
to Composer . Set sys_temp_dir in your php.ini
Composer version 1.6.5 2018-05-04 11:44:59
composer -version
PHP temp directory (D:\mysql\temp) does not exist or is not writable
to Composer . Set sys_temp_dir in your php.ini[Symfony\Component\Console\Exception\RuntimeException] The "-e"
option does not exist.Exception trace: () at
phar://C:/composer/composer.phar/vendor/symfony/console/Input/ArgvInput.p
hp:124
Symfony\Component\Console\Input\ArgvInput->parseShortOptionSet() at
phar://C:/c
omposer/composer.phar/vendor/symfony/console/Input/ArgvInput.php:105
Symfony\Component\Console\Input\ArgvInput->parseShortOption() at
phar://C:/comp
oser/composer.phar/vendor/symfony/console/Input/ArgvInput.php:84
Symfony\Component\Console\Input\ArgvInput->parse() at
phar://C:/composer/compos
er.phar/vendor/symfony/console/Input/Input.php:54
Symfony\Component\Console\Input\Input->bind() at
phar://C:/composer/composer.ph
ar/vendor/symfony/console/Command/Command.php:200
Symfony\Component\Console\Command\Command->run() at
phar://C:/composer/composer
.phar/vendor/symfony/console/Application.php:843
Symfony\Component\Console\Application->doRunCommand() at
phar://C:/composer/com
poser.phar/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at
phar://C:/composer/composer.p
har/src/Composer/Console/Application.php:251
Composer\Console\Application->doRun() at
phar://C:/composer/composer.phar/vendo
r/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at
phar://C:/composer/composer.pha
r/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at
phar://C:/composer/composer.phar/bin/com poser:59 require() at
C:\composer\composer.phar:24list [–xml] [–raw] [–format FORMAT] [–] []
Best Answer
Above error comes because of options shortcuts… here composer - version means composer -v… and which is not working in your case. That's the reason behind the last error stack.
Refer this link to see GitHub issue. the -e option does not exist
instead of running
composer -version
try to runand see it shows composer version or not...if not then the composer is not installed properly.
Then run
if you don't see version there. install composer and laravel again. Below link will be helpful for step by step installation.
laravel new doesn't work