Symfony/Skeleton 不要创建 env 文件,但 symfony/symfony-demo 可以



这是我的问题:

当我试图用"composer create project symfony/sketle project name"(或网站骨架(创建一个symfony项目时,我收到了一个错误,告诉我我没有.env文件

Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!!  Fatal error: Uncaught SymfonyComponentDotenvExceptionPathException: Unable to read the "C:UsersUsDesktopProjectsnewEranewera-back/.env" environment file. in C:UsersUsDesktopProjectsnewEranewera-backvendorsymfonydotenvDotenv.php:567
!!  Stack trace:
!!  #0 C:UsersUsDesktopProjectsnewEranewera-backvendorsymfonydotenvDotenv.php(114): SymfonyComponentDotenvDotenv->doLoad(false, Array)
!!  #1 C:UsersUsDesktopProjectsnewEranewera-backvendorsymfonydotenvDotenv.php(157): SymfonyComponentDotenvDotenv->loadEnv('C:\Users\Us\...', 'APP_ENV', 'dev', Array, false)
!!  #2 C:UsersUsDesktopProjectsnewEranewera-backvendorsymfonyruntimeSymfonyRuntime.php(107): SymfonyComponentDotenvDotenv->bootEnv('C:\Users\Us\...', 'dev', Array, false)
!!  #3 C:UsersUsDesktopProjectsnewEranewera-backvendorautoload_runtime.php(23): SymfonyComponentRuntimeSymfonyRuntime->__construct(Array)
!!  #4 C:UsersUsDesktopProjectsnewEranewera-backbinconsole(11): require_once('C:\Users\Us in C:UsersUsDesktopProjectsnewEranewera-backvendorsymfonydotenvDotenv.php on line 567
!!
Script @auto-scripts was called via post-update-cmd

但与symfony/symfony演示缓存:清除工作

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版本

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 1.8.0 2018-12-03 10:31:16

可能是什么问题?

编辑1:转到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

我遵循getcomposer.org上的教程,但当我执行此命令时:

curl -sS https://getcomposer.org/installer | php -- --check

我得到

All settings correct for using Composer

我也遇到了这个问题。我将php更新为8.1,问题就解决了!

相关内容

  • 没有找到相关文章

最新更新