Do you have ssh access?
If so before you can use npm you need to install node:
sudo apt-get update
sudo install nodejs
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
As Laracasts already covered Laravel Forge I hope someone can help me here. Basically I need npm to use gulp and so on, but I have no clue on how to install it on Laravel forge using my deploy scripts. Please help me with this one.
Do you have ssh access?
If so before you can use npm you need to install node:
sudo apt-get update
sudo install nodejs
If this is your production server, you shouldn't really be using gulp there anyway.
Use gulp on your development server/VM and push your changes and published files to production.
Many thanks, I now understood all the forge stuff and I'm using gulp only local :)
If you have your code in a git, just remember to run gulp before you commit :)
Can be easy to see the resources folder update but not the public folder version.
I don't want to install node.js and gulp in my production server.
But how do you manage your deployment then?
I mean, before git push, you have to run gulp in your dev env with the --production flag,
and then run a git add . because of new generated files (from the elixir versioning feature)?
And you have to remember to do that only if JS or LESS/SASS was updated (because otherwise, you lost the browser ressource caching for nothing).
Is someone has a better workflow (I think so...)?
Why would you need to do a git add?
If you're not ignoring your public folder, the published and versioned files will be pushed at the next commit, along with everything else.
No need for Gulp on the production server at all.
@sitesense Well, maybe I'm using git the wrong way, or maybe it's a PHPStorm thing, but when a new file is created from outside the IDE (this is the case with versioned JS or CSS files from Elixir), I have to add them to version control, otherwise they just stay out of it (and red in PHPStorm)...
@laloutre Ah I see, I use SourceTree which adds untracked files.
You can do the same thing though with a git alias. Put this in your ~/.gitconfig file :
[alias]
ca = !sh -c 'git add -A && git commit -m \"$1\"' -
Then use like:
$ git ca 'Your commit message'
why make an alias when git has a build in flag to help you?
git commit -a -m "your message"
@sitesense OK, thanks. It's clear now, I must find a way to tell PHPStorm to add the "-a" flag to the commit instruction when hitting cmd-K.
And for the Elixir --production flag, you always use it it dev mode?
This is a year old, but anyway –
Guys, I don't think, we should commit our compiled assets to our git repository. For small projects it is fine, but best practice would be to only commit source files (sass, coffee, etc.). There can always be differences between our development environment when working in a team. Configuration, versions, etc. might cause small errors or inconsistencies. Ideally, we would have a tool like buddy.works to standardize our asset compilation.
Please or to participate in this conversation.