Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dib258's avatar
Level 11

Forge deployement using Bower

Hi,

I'm trying to use bower on a laravel project and I was wondering If I need to update the Forge's deployement script

Here's the default one :

cd /home/forge/default
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force

do I need to add something like bower install ?

And do I need to go to ssh into my digitalocean's server to install all nodejs, npm and bower ?

Also should I then .gitignore the bower_components ?

If you have good tutoriels about configuring Laravel and Forge to make bower works, it would be really cool !

I already saw https://laracasts.com/series/laravel-5-and-the-front-end/episodes/2 but Jeffrey doesn't talk about forge deployement.

Thanks in advance !

0 likes
5 replies
christopher's avatar

mhhhh i would not run bower on your production server. What if a dependencie brakes some of your components ?

If you really want to do this on your production server, you could add the command bower update to update all bower dependencies.

Before you can run bower you have to run npm install on your machine to install the node dependencies.

dib258's avatar
Level 11

I don't really want to use bower on my server but my question is more like should I must to ?

because if I only use bower on local then I don't need to .gitignore them ?

What's the best way to do it ?

christopher's avatar

Why would you have your bower file in your .gitignore? Imagine that you need to clone your project on another machine, how should you install all your dependencie? The best way is to run bower locally in your development, thats it :)

bower is just to install your components, so you dont really need bower on a production server.

dib258's avatar
Level 11

not the bower.js but the bower_components ?

Isn't that the point of using a package manager ? When you use composer to install a new plugin, the plugin doesn't go on github and is redownloaded on the production machine. Is it different for bower plugins ?

christopher's avatar

Its a bit diffrent. If you install a package with bower you copy this packages to your resources directory with elixir for example and then you compile it all to one css / js file. On your production server you only need this compiled css / js file.

This is not done on your production server.

Please or to participate in this conversation.