gpt4 book ai didi

php - Symfony 4 安装没有 "public"文件夹。只有 "vendor/"。(无法打开输入文件 : bin/console)

转载 作者:行者123 更新时间:2023-12-02 20:26:22 25 4
gpt4 key购买 nike

我想学习 Symfony 框架,但我无法运行它。Composer 最新版本。我使用这个命令来安装框架,正如文档所说。比我使用这个命令在“project/”文件夹中启动服务器,但我收到错误“无法打开输入文件:bin/console”

duhan@dbalci:/var/www$ composer create-project symfony/skeleton project


Installing symfony/skeleton (v4.0.5)
- Installing symfony/skeleton (v4.0.5): Loading from cache
Created project in project
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 21 installs, 0 updates, 0 removals
- Installing symfony/flex (v1.0.78): Loading from cache
- Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
- Installing symfony/console (v4.0.8): Loading from cache
- Installing symfony/routing (v4.0.8): Loading from cache
- Installing symfony/http-foundation (v4.0.8): Loading from cache
- Installing symfony/yaml (v4.0.8): Loading from cache
- Installing symfony/framework-bundle (v4.0.8): Loading from cache
- Installing symfony/http-kernel (v4.0.8): Loading from cache
- Installing symfony/event-dispatcher (v4.0.8): Loading from cache
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v4.0.8): Loading from cache
- Installing symfony/finder (v4.0.8): Loading from cache
- Installing symfony/filesystem (v4.0.8): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/dependency-injection (v4.0.8): Loading from cache
- Installing symfony/config (v4.0.8): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing symfony/cache (v4.0.8): Loading from cache
- Installing symfony/dotenv (v4.0.8): Loading from cache
Writing lock file
Generating autoload files

duhan@dbalci:/var/www$ cd project/
duhan@dbalci:/var/www/project$ php bin/console server:run
Could not open input file: bin/console

只有“vendor/”文件夹,但我在教程中看到还有更多。
“ls -l”输出:

duhan@dbalci:/var/www/project$ ls -l
total 60
-rw-rw-r-- 1 duhan duhan 1231 Apr 13 13:30 composer.json
-rw-rw-r-- 1 duhan duhan 48230 Apr 13 13:30 composer.lock
-rw-rw-r-- 1 duhan duhan 3 Apr 13 13:30 symfony.lock
drwxrwxr-x 5 duhan duhan 4096 Apr 13 13:30 vendor

最佳答案

Composer 似乎还没有完全执行 symfony/flex 插件中的功能。我能想到会导致这种情况的唯一原因是,如果您全局禁用了插件(您可以通过运行composer config -l并查看它是否提到no-plugins<来诊断此问题 任何地方)

我可以通过运行复制您的目录结构:

composer create-project symfony/skeleton project --no-plugins
cd project
composer install

这将创建一个空的 symfony.lock 文件,但不会解压任何已安装的 Symfony 配方。

从这里,您应该能够通过运行来完成安装

composer fix-recipes

在项目文件夹中。这将完成所有已安装配方的解压,包括创建丢失的目录结构。

关于php - Symfony 4 安装没有 "public"文件夹。只有 "vendor/"。(无法打开输入文件 : bin/console),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49815111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com