首页 > 解决方案 > 尝试运行任何命令行命令时未找到 Mojolicious-lite 命令错误

问题描述

我自己创建了 mojolicious-lite 应用程序(只是手动创建了我需要的文件,而不是使用“创建应用程序”命令)。我正在跟随这里的教程:https ://www.perl.com/article/193/2015/9/18/How-to-send-verification-emails-using-Mojolicious/

尝试在我的应用程序中使用任何命令行命令时,我遇到了错误。从本教程中,我特别想运行:

./hello.pl minion job

但更一般地说,我也注意到似乎没有命令对我有用,例如:

./hello.pl help
./hello.pl routes

错误似乎与解析我的 postgres 助手有关?这是确切的错误消息:

./hello.pl help
./hello.pl: line 1: use: command not found
./hello.pl: line 2: use: command not found
./hello.pl: line 3: use: command not found
./hello.pl: line 4: use: command not found
./hello.pl: line 5: use: command not found
./hello.pl: line 6: use: command not found
./hello.pl: line 7: use: command not found
./hello.pl: line 10: syntax error near unexpected token `('
./hello.pl: line 10: `helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test_users') };'

除了从命令行调用命令外,我的应用程序运行良好。

这是我的应用程序的前 11 行:

use Mojolicious::Lite;
use Mojo::ByteStream;
use Mojo::JWT;
use Mojo::Pg;
use Mojolicious::Plugin::Bcrypt;
use Mojolicious::Plugin::Minion;
use Data::Dumper;


helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test_users') };
app->pg->migrations->from_data->migrate;

标签: perlmojolicious-lite

解决方案


推荐阅读