Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Can't find application class in @INC when starting Mojolicious-generated app

by djevox (Initiate)
on Oct 12, 2019 at 13:56 UTC ( [id://11107375]=perlquestion: print w/replies, xml ) Need Help??

djevox has asked for the wisdom of the Perl Monks concerning the following question:

I'm completely new to Perl, so please be gentle. I generated a mojolicious app with the command mojo generate app first-app. It generated the app structure that should allow a running example when running the dev server with morbo ./script/first-app.

The file structure looks like this: https://i.postimg.cc/wBBd4GFv/Screenshot-from-2019-10-12-09-09-42.png

My error when running morbo ./script/first-app in the root of the project directory is this error:

Can't load application from file "/home/djnorrisdev/Documents/mojo-pra +ctice/first-app/script/first-app": Can't find application class "firs +t-app" in @INC. (/home/djnorrisdev/Documents/mojo-practice/first-app/ +lib /home/djnorrisdev/perl5/perlbrew/perls/perl-5.30.0/lib/site_perl/ +5.30.0/x86_64-linux /home/djnorrisdev/perl5/perlbrew/perls/perl-5.30. +0/lib/site_perl/5.30.0 /home/djnorrisdev/perl5/perlbrew/perls/perl-5. +30.0/lib/5.30.0/x86_64-linux /home/djnorrisdev/perl5/perlbrew/perls/p +erl-5.30.0/lib/5.30.0) Compilation failed in require at (eval 72) line 1

I tried using the full path for morbo (as mentioned in a 6 year old SO post), but that gives the same error as above. That command was this: /home/djnorrisdev/perl5/perlbrew/pls/perl-5.30.0/bin/morbo ./script/first-app

Running morbo script/first-app gives the same error.

I'm guessing anyone familiar with a full mojolicious app would be familiar with the script file, but here's the contents of script/first-app:
#!/usr/bin/env perl use strict; use warnings; use Mojo::File 'curfile'; use lib curfile->dirname->sibling('lib')->to_string; use Mojolicious::Commands; # Start command line interface for application Mojolicious::Commands->start_app('first-app');

Considering this is a mojolicious-generated app, I would assume it should not get an @INC error and run with morbo without issue. Does anyone have insight into this?

Edit: I forgot my env info. I'm on ubuntu 18.04LTS and am using Perl 5.30.0. I do have perlbrew installed also, and all my editing is done in vscode.

Replies are listed 'Best First'.
Re: Can't find application class in @INC when starting Mojolicious-generated app
by marto (Cardinal) on Oct 12, 2019 at 14:57 UTC

    " I generated a mojolicious app with the command mojo generate app first-app. It generated the app structure.."

    Didn't it say something like:

    marto@Shemp:~/mojotmp$ mojo generate app first-app Your application name has to be a well formed (CamelCase) Perl module +name like "MyApp".

    "My error when running morbo ./script/first-app in the root of the project directory is this error:"

    morbo ./script/first-app should be morbo script/first-app, of if you stayed in the directory you ran mojo generate... morbo first_app/script/first_app

      Wow, I can't believe I missed that- I feel like a noob all over again. Thanks for the help!

        Anytime, a second pair of eyes is very useful when you've been looking at a problem :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11107375]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found