Carousel is not a function in index.php


#1

UF newbie here, just completed a UF installation, but I’m getting an error “carousel is not a function” when I try to test the site. There’s a closed issue (#608) on github, the solution refers to updated documentation, and the need to install Bower. The only place I see Bower referenced is in the section on homestead. Must I install homestead to run UF? I re-ran the ‘bakery bake’ process, and it appears that bower did install, but I still get this error. Can anyone point me in the right direction?


#2

You are correct, Bakery should automatically install Bower for you (though we will be getting away from Bower in v4.2).

You do not need to install Homestead, but you do need to have a working stack installed. Are you getting any CSS styling at all on the front page? If it’s completely unstyled, then likely either none of your Bower dependencies were installed, or your webserver is not set up to forward all requests to index.php. Which webserver (Apache, nginx, etc) are you using?


#3

Thanks for the response Alex.

My environment is Apache 2.4, PHP 7.2.5, PostgreSQL 9.6 running on Windows 10 locally (no public access). It’s working in the respect that a small development project I’ve been working on (as a means to learn Apache, PHP/PDO, Javascript, JQuery, etc., etc.) works. However I admit I’m a complete neophyte to web development; each of these packages was installed using the stock installers – not the WAMP distribution – with only very minor configuration to insure all the piece parts fit together. Whether that constitutes a “working stack” is debatable. (It works for me, but… ;))

The UF .htaccess file is in the userfrosting\public folder, but I don’t think it’s working to forward requests to index.php. I added a simple “hello world” index.html file to public, and that’s what comes up if I navigate to localhost. If I navigate explicitly to localhost/index.php, I get the UF demo site, but with no styling. So maybe I have something wrong in my httpd.conf file??

BTW, the problem goes beyond just the carousel – I only looked at the debugger screen when I posted yesterday, but the console log includes a number of errors “Loading failed for the script…” all referencing folder "assets-raw/core/assets/…, which doesn’t exist on my system. (And notably, bootstrap.js is among them, which I’m sure causes the carousel error.)

You mentioned something about the Bower dependencies not being installed – how can I check that?


#4

Ah, yep it sounds like your web server isn’t configured correctly to forward these requests.

So, like a lot of web dev newbies, you are conflating URLs with file paths. In the case of UserFrosting raw assets, requests to URLs starting with assets-raw/ should actually be forwarded to index.php (and all page requests, as well). Then, UF automatically locates, reads, and responds to the request with the contents of the corresponding file. This is similar to what a webserver like Apache or nginx does, but we forward it through the actual UF application since assets are spread out and can be overridden in different Sprinkles.

tl;dr: we need to get your webserver configured properly.

Have you checked out the webserver troubleshooting page? Also, please join us in chat so we can further troubleshoot this problem.


#5

I did go through the troubleshooting process earlier, but that was before I stumbled on the forwarding not working. I should have gone back and looked at it again since (as you probably realized) the answer was right there. Changing “Override None” to “Override All” under “Enabling .htaccess” did the trick, it’s all coming up great now. Thanks for your patience with a newbie. :slight_smile: