【问题标题】:php artisan command not working in ubuntuphp artisan 命令在 ubuntu 中不起作用
【发布时间】:2020-10-27 14:27:50
【问题描述】:

当我在我的 laravel 项目中执行 php artisan 或 php artisan serve 时,它​​会显示一些错误,我不知道如何解决它。我尝试删除作曲家并再次安装它也进行作曲家更新,但它似乎并没有解决问题。 操作系统:Ubuntu 20.04 LTS

我的错误:

wiggly@Wiggly-Faun:~/Desktop/Web Designing/websites/Ticketing$ php artisan serve
PHP Warning:  require(/home/wiggly/Desktop/Web 
Designing/websites/Ticketing/vendor/autoload.php): failed to open stream: No such file or 
directory in /home/wiggly/Desktop/Web Designing/websites/Ticketing/artisan on line 18
PHP Fatal error:  require(): Failed opening required '/home/wiggly/Desktop/Web 
Designing/websites/Ticketing/vendor/autoload.php' (include_path='.:/usr/share/php') in 
/home/wiggly/Desktop/Web Designing/websites/Ticketing/artisan on line 18

当我在我的项目中安装作曲家时,会显示:

wiggly@Wiggly-Faun:~/Desktop/Web Designing/websites/Ticketing$ 
composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of 
packages.

Problem 1
- Installation request for laravel/framework v7.18.0 -> satisfiable 
by laravel/framework[v7.18.0].
- laravel/framework v7.18.0 requires ext-mbstring * -> the requested 
PHP extension mbstring is missing from your system.
Problem 2
- Installation request for league/commonmark 1.5.1 -> satisfiable by 
league/commonmark[1.5.1].
- league/commonmark 1.5.1 requires ext-mbstring * -> the requested 
PHP extension mbstring is missing from your system.
Problem 3
- Installation request for tijsverkoyen/css-to-inline-styles 2.2.2 - 
> satisfiable by tijsverkoyen/css-to-inline-styles[2.2.2].
- tijsverkoyen/css-to-inline-styles 2.2.2 requires ext-dom * -> the 
requested PHP extension dom is missing from your system.
Problem 4
- Installation request for facade/ignition 2.0.7 -> satisfiable by 
facade/ignition[2.0.7].
- facade/ignition 2.0.7 requires ext-mbstring * -> the requested PHP 
extension mbstring is missing from your system.
Problem 5
- Installation request for phar-io/manifest 1.0.3 -> satisfiable by 
phar-io/manifest[1.0.3].
- phar-io/manifest 1.0.3 requires ext-dom * -> the requested PHP 
extension dom is missing from your system.
Problem 6
- Installation request for phpunit/php-code-coverage 7.0.10 -> 
satisfiable by phpunit/php-code-coverage[7.0.10].
- phpunit/php-code-coverage 7.0.10 requires ext-dom * -> the 
requested PHP extension dom is missing from your system.
Problem 7
- Installation request for phpunit/phpunit 8.5.8 -> satisfiable by 
phpunit/phpunit[8.5.8].
- phpunit/phpunit 8.5.8 requires ext-dom * -> the requested PHP 
extension dom is missing from your system.
Problem 8
- Installation request for scrivo/highlight.php v9.18.1.1 -> 
satisfiable by scrivo/highlight.php[v9.18.1.1].
- scrivo/highlight.php v9.18.1.1 requires ext-mbstring * -> the 
requested PHP extension mbstring is missing from your system.
Problem 9
- Installation request for theseer/tokenizer 1.1.3 -> satisfiable by 
theseer/tokenizer[1.1.3].
- theseer/tokenizer 1.1.3 requires ext-dom * -> the requested PHP 
extension dom is missing from your system.
Problem 10
- laravel/framework v7.18.0 requires ext-mbstring * -> the requested 
PHP extension mbstring is missing from your system.
- facade/flare-client-php 1.3.2 requires illuminate/pipeline 
^5.5|^6.0|^7.0 -> satisfiable by laravel/framework[v7.18.0].
- Installation request for facade/flare-client-php 1.3.2 -> 
satisfiable by facade/flare-client-php[1.3.2].

To enable extensions, verify that they are enabled in your .ini 
files:
- /etc/php/7.4/cli/php.ini
- /etc/php/7.4/cli/conf.d/10-opcache.ini
- /etc/php/7.4/cli/conf.d/10-pdo.ini
- /etc/php/7.4/cli/conf.d/20-calendar.ini
- /etc/php/7.4/cli/conf.d/20-ctype.ini
- /etc/php/7.4/cli/conf.d/20-exif.ini
- /etc/php/7.4/cli/conf.d/20-ffi.ini
- /etc/php/7.4/cli/conf.d/20-fileinfo.ini
- /etc/php/7.4/cli/conf.d/20-ftp.ini
- /etc/php/7.4/cli/conf.d/20-gettext.ini
- /etc/php/7.4/cli/conf.d/20-iconv.ini
- /etc/php/7.4/cli/conf.d/20-json.ini
- /etc/php/7.4/cli/conf.d/20-phar.ini
- /etc/php/7.4/cli/conf.d/20-posix.ini
- /etc/php/7.4/cli/conf.d/20-readline.ini
- /etc/php/7.4/cli/conf.d/20-shmop.ini
- /etc/php/7.4/cli/conf.d/20-sockets.ini
- /etc/php/7.4/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.4/cli/conf.d/20-sysvsem.ini
- /etc/php/7.4/cli/conf.d/20-sysvshm.ini
- /etc/php/7.4/cli/conf.d/20-tokenizer.ini
- /etc/php/7.4/cli/conf.d/20-zip.ini
You can also run `php --ini` inside terminal to see which files are 
used by PHP in CLI mode.

【问题讨论】:

标签: php composer-php laravel-artisan artisan-serve


【解决方案1】:

您是否在本地安装了所有必要的供应商软件包?您的“供应商”目录是否存在?

别忘了使用:

composer install

在项目目录中安装必要的供应商包。

另外,请确保您已经安装了必要的 PHP 扩展,例如 mbstringxml,您可以通过以下方式安装它们:

sudo apt install php-xml php-mbstring

希望这有助于解决您的问题。

【讨论】:

  • laravel网站文件也有vendor文件夹吗?
  • @NutanPanta 成功了吗?您似乎缺少必要的供应商文件。确保您的“作曲家安装”成功。
  • @tgram 我需要在我的 laravel 项目中安装 composer 吗?
  • @NutanPanta 是的,在项目目录中使用“composer install”。
  • @tgram 我已经编辑了我的帖子,并保留了我在项目中安装 composer install 时显示的内容。
猜你喜欢
  • 2021-05-10
  • 2016-04-01
  • 2019-08-18
  • 2019-06-17
  • 2017-10-10
  • 2016-02-15
  • 1970-01-01
  • 1970-01-01
  • 2016-08-19
相关资源
最近更新 更多