找不到Laravel命令。但它被添加到我在ubuntu上的$路径

发布于 2025-02-07 19:34:56 字数 924 浏览 0 评论 0 原文

但是如果它们完全一样,

我想启动我的第一个laravel项目

所以我知道有很多模拟问题, 当运行 Composer Global需要“ Laravel/Installer” 时,它可以完美地运行,没有任何问题,我会得到此响应:

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

这告诉我Laravel确实已安装但没有更新,但是当我运行命令 laravel 响应是 laravel:找不到命令

我已经在我的$路径中添加了作曲家。

这就是为什么我发布此问题的原因,因为我发现的所有帖子都说要将作曲家添加到您的$路径中,但是我的已经是一个问题。

PHP也安装在我的机器上

,我正在运行Linux Ubuntu 22.04 LTS

So I know there are alot of simmular issues but none if them are exactly the same,

I want to start my first laravel project but, my terminal tells me command not found,

I installed composer from the website and when I run composer I can see that it works perfectally with no issue, when running composer global require "laravel/installer" I get this in response :

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

This tells me that laravel is indeed installed but has not updates but when I run command laravel the response is laravel: command not found,

I have added composer to my $PATH already.

This is why I am posting this issue because all the posts I find says to add composer to your $PATH but mine is already but its still a issue.

PHP is also installed on my machine

I am running linux Ubuntu 22.04 LTS

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜光 2025-02-14 19:34:57

对于想要使用Laravel命令在Ubuntu上创建项目的任何人,您应该将$路径设置为〜/.config/.config/composer/vendor/bin 而不是〜/。 -COSER/供应商/bin 。您可以在.bashrc(或任何其他shell配置文件,例如.zshrc)中导出它,例如

export path = $ home/.config/.config/composer/vendor/bin/bin:$ path

然后运行 source〜/.bashrc (或 source〜/.zshrc )应用更改,您应该很好。

For anyone who wants to use the Laravel command to create a project on Ubuntu, you should set the $PATH to ~/.config/composer/vendor/bin instead of ~/.composer/vendor/bin. You can export it in your .bashrc (or any other shell config file, such as .zshrc) like this

export PATH=$HOME/.config/composer/vendor/bin:$PATH

then just run source ~/.bashrc (or source ~/.zshrc) to apply the changes and you should be good to go.

待"谢繁草 2025-02-14 19:34:56

我将在这里写答案,以便您可以解决问题。 AS @geertjanknapen 在评论中在评论中说,如果您可以安装项目,

composer create-project laravel/laravel your-app-name
cd /your-app-name
php artisan serve

则必须在运行本地服务器,一旦运行本地服务器,运行 PHP Artisan服务,然后转到 http://127.0.0.0.1.1:8000/ < /a>,您会看到Laravel的主屏幕。 (注意8000是默认端口,因此,如果您更改了它,请将其放在那里)。

I'll write the answer here so you can close the question. As @geertjanknapen said in the comment if you can install your project the run

composer create-project laravel/laravel your-app-name
cd /your-app-name
php artisan serve

You must have a local server running also, once you have run php artisan serve then just go to http://127.0.0.1:8000/ and you'll see Laravel's home screen. (NOTE 8000 is the default port, so put yours there if you've changed it).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文