Here's my problem :
When I try to create a symfony project with 'composer create-project symfony/skeleton project-name' (or website-skeleton) I got this error telling me I don't have .env-file
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "C:\Users\Us\Desktop\Projects\newEra\newera-back/.env" environment file. in C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php:567
!! Stack trace:
!! #0 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
!! #1 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv('C:\\Users\\Us\\...', 'APP_ENV', 'dev', Array, false)
!! #2 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\runtime\SymfonyRuntime.php(107): Symfony\Component\Dotenv\Dotenv->bootEnv('C:\\Users\\Us\\...', 'dev', Array, false)
!! #3 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\autoload_runtime.php(23): Symfony\Component\Runtime\SymfonyRuntime->__construct(Array)
!! #4 C:\Users\Us\Desktop\Projects\newEra\newera-back\bin\console(11): require_once('C:\\Users\\Us in C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php on line 567
!!
Script @auto-scripts was called via post-update-cmd
But with symfony/symfony-demo the cache:clear works
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [OK]
Executing script assets:install public [OK]
PHP version
PHP 7.4.30 (cli) (built: Jun 7 2022 18:05:59) ( ZTS Visual C 2017 x86 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Composer version
Composer version 1.8.0 2018-12-03 10:31:16
What could be the problem ?
Edit 1 : after going to php 8.1
Problem 1
- symfony/flex v2.2.2 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.2.1 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.2.0 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.8 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.7 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.6 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.5 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.4 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.3 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.2 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.1 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.0 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.0.1 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.0.0 requires composer-plugin-api ^2.1 -> no matching package found.
- Installation request for symfony/flex ^2 -> satisfiable by symfony/flex[v2.0.0, v2.0.1, v2.1.0, v2.1.1, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7, v2.1.8, v2.2.0, v2.2.1, v2.2.2].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
I follow the tuto on getcomposer.org but when I do this command :
curl -sS https://getcomposer.org/installer | php -- --check
I get
All settings correct for using Composer
EDIT 2 SOLUTION I was using Laragon, I just needed to uptade my composer in it.
CodePudding user response:
I had this problem too. I updated php
to 8.1
and the problem was solved!