Reputation: 4222
I'm developing an application using the latest Laravel 7 along with deploying to AWS using Vapor. I'm on Windows 10 environment.
When running the following command to deploy to staging vendor/bin/vapor deploy
I get the following error.
In Process.php line 252:
The command "COMPOSER_MIRROR_PATH_REPOS=1 composer install" failed.
Exit Code: 1(General error)
Working directory: C:\Users\Matthew Wallace\Development\web\615ioDemos/.vap
or/build/app
Output:
================
Error Output:
================
'COMPOSER_MIRROR_PATH_REPOS' is not recognized as an internal or external c
ommand,
operable program or batch file.
Upvotes: 5
Views: 3702
Reputation: 434
Following line causes the issue:
'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'
It's a script that can run on bash
. It basically sets an environment variable, then calls composer
with some options and parameters. If your operating system is Windows, you will need the counterpart syntax in cmd
, which can be as follows:
'set COMPOSER_MIRROR_PATH_REPOS=1 & composer install --no-dev'
Upvotes: 0
Reputation: 21
As our team also face this issue, and we need to use in multiple projects, we made a command that is accessible in a package. Just install and do simple setup will do
https://packagist.org/packages/stephenkhoo/laravel-vapor-deploy-helper
composer require stephenkhoo/laravel-vapor-deploy-helper
Update your vapor.yml from
build:
- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'
to
build:
- 'php artisan build:composer-mirror'
- 'composer install --no-dev'
Upvotes: 2
Reputation: 409
The answer above is just partly a fix. (answ by @mattwallace)
The whole story:
COMPOSER_MIRROR_PATH_REPOS=1
in vapor.yml"COMPOSER_MIRROR_PATH_REPOS": true
More details:
You'll probably run into problems while attaching a database to your app while working on Win (at least I did :P).
The issue is with the strategy of resolving paths. By default the strategy is set to "symlink" - I assume the more appropriate way would be to set this to "mirror", as we build the project locally and move the content on a different host (filesystem structure etc.).
The error above is just the terminal/powershell not knowing how to handle the first param in the command line - COMPOSER_MIRROR_PATH_REPOS
- it still needs to be set up.
More about the param here.
In the docs you can find:
You can set a number of environment variables that override certain settings. Whenever possible it is recommended to specify these settings in the config section of composer.json instead.
There you go:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"COMPOSER_MIRROR_PATH_REPOS": true
},
Upvotes: 3
Reputation: 4222
The solution for this problem was to open the vapor.yml and modify the composer install lines in the build:
sections for staging and production by removing 'COMPOSER_MIRROR_PATH_REPOS=1'
This is what my build section looks like now.
build:
- 'composer install'
- 'php artisan event:cache'
- 'npm ci && npm run dev && rm -rf node_modules'
Upvotes: 3