Expcetion: Resource '/assets/jquery/dist/jquery.min.js' does not have a valid source path


I'm trying to get a minifed and combined version of my Javascript files with:

        ->addJs('/assets/jquery/dist/jquery.min.js', true, false)
        ->addJs('/assets/bootstrap/js/bootstrap.min.js', true, false)
        ->addJs('/common/js/luna.js', true)
        ->addJs('/user/js/custom.js', true)
        ->addJs('/assets/datatables/jquery.dataTables.min.js', true)
        ->addJs('/assets/datatables/dataTables.bootstrap.js', true)
        ->addFilter(new Jsmin());

I get this exception:

Exception: Resource '/assets/jquery/dist/jquery.min.js' does not have a valid source path

What should I change?



try with full path to the file ?

but honestly i gave up on those and started using gulp. After all, npm is made for this kind of stuff

You should provide correct path.


@Izo, yeah, gulp might be the solution.

@Wojciech Ślawski, I used this path the whole time before but without joining the files. Now wanted to take this further.


Okay, I was able to resolve this with setting up the whole path. But now, the shown script "final.js" isn't created.

<script type="text/javascript" src="/final.js"></script>

Exception: Service 'view' wasn't found in the dependency injection container

Add view service to di ?

Problably you have application in subfolder, for example "localhost/yourapp/"

If i have right you should set BaseUri and StaticBaseUri. Example:

    function () use ($config) {
        $url = new UrlResolver();
        return $url;


@Jurigag, it's defined. I work on my app pretty long now I used the assets manager the whole time. I just deciedet to make use of the join and minify function.

@Pwoszczyk, I can invoke my app through localhost:8004/. Maybe the port is the problem?

It depends of your web server.

edited Nov '16

May one of you post a full example?

edited Nov '16

Apache2 on Ubuntu

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
    Listen 443

<IfModule mod_gnutls.c>
    Listen 443

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


@pwoszczyk, :) I meant a full working example within Phalcon assets. That would be nice!

edited Nov '16


I locate JS files in myapp/public/vendor/*


<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  ^$ public/    [L]
    RewriteRule  (.*) public/$1 [L]


AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]

DI config in services.php

    function () use ($config) {
        $url = new UrlResolver();
        $url->setBaseUri($config->application->path); // /myapp/
        $url->setStaticBaseUri($config->application->staticPath); // http://localhost/myapp/

        return $url;

Use in volt

{% block js %}
    {% do assets.collection('vendor-js').addJs('vendor/jquery/dist/jquery.min.js') %}
    {% do assets.collection('vendor-js').addJs('vendor/bootstrap/dist/js/bootstrap.min.js') %}
{% endblock %}
{{ assets.outputJs('vendor-js') }}

In my mind this elements are most important.


My enviroment should be alright. I am using these lines of code already and it's working:


My root path is /. Could you provide an example of your assets definition inside your controller?

No problem...