Skip to content

Production pre-compile generates an error #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tsiedsma opened this issue Dec 1, 2014 · 11 comments
Closed

Production pre-compile generates an error #6

tsiedsma opened this issue Dec 1, 2014 · 11 comments
Labels

Comments

@tsiedsma
Copy link

tsiedsma commented Dec 1, 2014

I've been testing your package and have run into an issue in my local and development environments.
Both systems produce the exact same error when trying to pre-compile assets for production use.

$ php artisan larasset:precompile --environment production

[InvalidArgumentException]
There are no commands defined in the "larasset" namespace.

Running the same command without the environment option does a successful pre-compile but does not minify or compress anything.

laravel.log entry:

[2014-12-01 15:55:06] false.ERROR: exception 'InvalidArgumentException' with message 'There are no commands defined in the "larasset" namespace.' in /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:516
Stack trace:
#0 /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php(550): Symfony\Component\Console\Application->findNamespace('larasset')
#1 /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php(190): Symfony\Component\Console\Application->find('larasset:precom...')
#2 /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /vagrant/artisan(59): Symfony\Component\Console\Application->run()
#4 {main} [] []
@tortuetorche
Copy link
Contributor

Hi,

Can you run this command in your terminal ?

php artisan env

It should not output production, can you check this ?

And you need to enable debug mode in your local or development environment.
Create or edit the file app/config/local/app.php:

<?php

return [
    'debug' => true,
    // Others config options....
];

See also #5

@tsiedsma
Copy link
Author

tsiedsma commented Dec 1, 2014

Current application environment: local

Debug is set to true in my app/config/local/app.php

@tortuetorche
Copy link
Contributor

Can you try to create or edit this file app/config/app.php:

<?php

return [
    'debug' => true,
    // Others config options....
];

@tortuetorche
Copy link
Contributor

The issue is here.

This code doesn't seem to work with local env:

$this->app['config']->get('app.debug')

I need to find a way to read the debug config option in other env than production...

@tsiedsma
Copy link
Author

tsiedsma commented Dec 1, 2014

Thank you, setting debug true in production app.php did the trick.

I have another question. My local server is on vagrant and uses apache, when larasset generates links to assets, it uses localhost:3000, is there a way to have it use the real url and port like the rest of laravel? I'm not running the artisan server...

<link media="all" type="text/css" rel="stylesheet" href="http://localhost:3000/assets/application.css">

Should Be:

<link media="all" type="text/css" rel="stylesheet" href="http://localhost:8080/assets/application.css">

@tortuetorche
Copy link
Contributor

If your application is in production mode and your assets are precompiled it should be OK.

@tsiedsma
Copy link
Author

tsiedsma commented Dec 1, 2014

It's my local dev instance, it's in local mode. I need to be able to work on my local dev instance and have the links generate properly.

http://localhost:3000/assets/application.css is a 404, that port doesn't exist and is not forwarded through vagrant.

@tortuetorche
Copy link
Contributor

You can set this env variable : ASSETS_ENV=local

@tsiedsma
Copy link
Author

tsiedsma commented Dec 1, 2014

I can confirm that works, thank you for your prompt help!

@tsiedsma tsiedsma closed this as completed Dec 1, 2014
@tortuetorche tortuetorche reopened this Dec 1, 2014
@tortuetorche
Copy link
Contributor

OK, I reopen this issue because of the local debug config option bug.

tortuetorche pushed a commit that referenced this issue Dec 2, 2014
Because there was some conflicts with the Laravel command line option '
--env'.
And 'larasset-environment' command line option is renamed to
'--larasset-env'.

See #6 for more
information.
@tortuetorche
Copy link
Contributor

The commit 8559325 fix this issue.
So the --environment command line option is renamed to --assets-env. and larasset-environment command line option is renamed to --larasset-env.
So don't forget to change your build script 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants