Skip to content
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

Installation Problems: 'Web path is not set' #133

Open
frazDev opened this issue May 15, 2015 · 3 comments
Open

Installation Problems: 'Web path is not set' #133

frazDev opened this issue May 15, 2015 · 3 comments

Comments

@frazDev
Copy link

frazDev commented May 15, 2015

Hi,

I've tried to use this module in a fresh zf2 ZendSkeletonApplication. I've read/followed the How To and the Configuration guide but i get error in browser and after the command line:

php public/index.php assetic setup

The Error is:

Fatal error: Uncaught exception 'AsseticBundle\Exception\RuntimeException' with message 'Web path is not set' in vendor\widmogrod\zf2-assetic-module\src\AsseticBundle\Configuration.php:185

My configuration file:

config/autoload/assets.config.php

<?php
// configs/assets.config.php
return array(
    'assetic_configuration' => array(

        'debug' => true,
        'buildOnRequest' => true,

        'webPath' => realpath('public/assets'),
        'basePath' => 'assets',

        'cachePath' => 'data/cache',
        'cacheEnabled' => false,    

        'routes' => array(
            'home' => array(
                '@base_js',
                '@base_css',
            ),
        ),

        'modules' => array(
            'Application' => array(
                'root_path' => __DIR__ . '/../assets',
                'collections' => array(
                    'base_css' => array(
                        'assets' => array(
                            'css/bootstrap-theme.min.css',
                            'css/style.css',
                            'css/bootstrap.min.css'
                        ),
                        'filters' => array(
                            'CssRewriteFilter' => array(
                                'name' => 'Assetic\Filter\CssRewriteFilter'
                            )
                        ),
                    ),

                    'base_js' => array(
                        'assets' => array(
                            'js/html5shiv.js',
                            'js/jquery.min.js',
                            'js/bootstrap.min.js',
                        )
                    ),

                    'base_images' => array(
                        'assets' => array(
                            'img/*.png',
                            'img/*.ico',
                        ),
                        'options' => array(
                            'move_raw' => true,
                        )
                    ),
                ),
            ),
        ),
    )
);

The directory structure is:
dir

I'm running XAMPP on W7.

Can anyone help me to troubleshoot this problem?

@widmogrod
Copy link
Owner

Could you provide full stack trace of the error?
Could you try to var_dump result of 'webPath' => realpath('public/assets'),

@frazDev
Copy link
Author

frazDev commented May 16, 2015

I switched to a LAMP env because I have not access to that machine but I still get the same error.
Where should I dump the webpath value? If you take a look here you will find the stack error and the dump of the Configuration class before the error is thrown.

The command line full error output is the following:

The application has thrown an exception!

Zend\ServiceManager\Exception\ServiceNotCreatedException

An exception was raised while creating "AsseticService"; no instance returned

/var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:946
#0 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'asseticbundlese...', 'AsseticService')
#1 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('asseticbundlese...', 'AsseticService')
#2 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('AsseticService', 'asseticbundlese...')
#3 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#4 /var/www/frazdev/zf2/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Initializer/AsseticBundleInitializer.php(24): Zend\ServiceManager\ServiceManager->get('AsseticService')
#5 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(666): AsseticBundle\Initializer\AsseticBundleInitializer->initialize(Object(AsseticBundle\Controller\ConsoleController), Object(Zend\Mvc\Controller\ControllerManager))
#6 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('AsseticBundle\C...', 'asseticbundleco...')
#7 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#8 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(116): Zend\ServiceManager\ServiceManager->get('AsseticBundle\C...', false)
#9 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/ControllerManager.php(137): Zend\ServiceManager\AbstractPluginManager->get('AsseticBundle\C...', Array, false)
#10 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(76): Zend\Mvc\Controller\ControllerManager->get('AsseticBundle\C...')
#11 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#13 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /var/www/frazdev/zf2/public/index.php(17): Zend\Mvc\Application->run()

#16 {main}

Previous Exception(s):

Zend\ServiceManager\Exception\ServiceNotCreatedException

An exception was raised while creating "AsseticAssetWriter"; no instance returned

/var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:946
#0 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'asseticbundlese...', 'AsseticService')
#1 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('asseticbundlese...', 'AsseticService')
#2 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('AsseticService', 'asseticbundlese...')
#3 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#4 /var/www/frazdev/zf2/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Initializer/AsseticBundleInitializer.php(24): Zend\ServiceManager\ServiceManager->get('AsseticService')
#5 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(666): AsseticBundle\Initializer\AsseticBundleInitializer->initialize(Object(AsseticBundle\Controller\ConsoleController), Object(Zend\Mvc\Controller\ControllerManager))
#6 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('AsseticBundle\C...', 'asseticbundleco...')
#7 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#8 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(116): Zend\ServiceManager\ServiceManager->get('AsseticBundle\C...', false)
#9 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/ControllerManager.php(137): Zend\ServiceManager\AbstractPluginManager->get('AsseticBundle\C...', Array, false)
#10 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(76): Zend\Mvc\Controller\ControllerManager->get('AsseticBundle\C...')
#11 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#13 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /var/www/frazdev/zf2/public/index.php(17): Zend\Mvc\Application->run()

#16 {main}

AsseticBundle\Exception\RuntimeException

Web path is not set

/var/www/frazdev/zf2/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Configuration.php:185
#0 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'asseticbundlese...', 'AsseticService')
#1 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('asseticbundlese...', 'AsseticService')
#2 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('AsseticService', 'asseticbundlese...')
#3 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#4 /var/www/frazdev/zf2/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Initializer/AsseticBundleInitializer.php(24): Zend\ServiceManager\ServiceManager->get('AsseticService')
#5 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(666): AsseticBundle\Initializer\AsseticBundleInitializer->initialize(Object(AsseticBundle\Controller\ConsoleController), Object(Zend\Mvc\Controller\ControllerManager))
#6 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('AsseticBundle\C...', 'asseticbundleco...')
#7 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#8 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(116): Zend\ServiceManager\ServiceManager->get('AsseticBundle\C...', false)
#9 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/ControllerManager.php(137): Zend\ServiceManager\AbstractPluginManager->get('AsseticBundle\C...', Array, false)
#10 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(76): Zend\Mvc\Controller\ControllerManager->get('AsseticBundle\C...')
#11 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#13 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /var/www/frazdev/zf2/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /var/www/frazdev/zf2/public/index.php(17): Zend\Mvc\Application->run()
#16 {main}

This is config/application.config.php

// This should be an array of module namespaces used in the application.
'modules' => array(
    'Application',
         'AsseticBundle' // <= declare you want to use AsseticModule 
),

@kersten
Copy link
Contributor

kersten commented Dec 10, 2015

Just for clarification, you need to rename asset.config.php into asset.global.php ind the autoload directory.

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

No branches or pull requests

3 participants