Symfony 3.0 安装

2022-08-30 22:11:45

我是symfony的新手,从上个月开始,我不断在终端上使用ubuntu上的以下命令安装新的symfony项目

# Linux, Mac OS X
$ symfony new my_project_name

直到今天,它一直完美运行,但不仅仅是检查新版本发布,但现在它开始给我以下错误

Downloading Symfony...

    4.93 MB/4.93 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  100%

 Preparing project...

PHP Warning:  require(/var/www/projectname/app/SymfonyRequirements.php): failed to open stream: No such file or directory in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/symfony:0
PHP   2. require() /usr/local/bin/symfony:10
PHP   3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP   4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP   5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP   6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP   7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP   8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
PHP Fatal error:  require(): Failed opening required '/var/www/projectname/app/SymfonyRequirements.php' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/symfony:0
PHP   2. require() /usr/local/bin/symfony:10
PHP   3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP   4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP   5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP   6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP   7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP   8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65

我甚至在位置usr/local/bin/symfony检查了symfony,它就在那里。


答案 1

这是一个已解决的问题,您需要指定要安装的版本。如此处此处所述,您需要:

  1. 更新安装程序

    >symfony self-update
    

    或使用 sudo,具体取决于您的安装方式:

    >sudo symfony self-update
    
  2. 指定版本:

    >symfony new my_project_name 3.0
    

希望这有帮助。

更新

有了Symfony安装程序上错误的正确分辨率,现在3.0是默认版本。在其他情况下,您可以指定完整版本(包括次要版本和主要版本),如下所示:

>symfony new my_project_name 3.0.0

答案 2

推荐