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

JoshP's avatar
Level 7

First deploy to production after setting up Mix

Hiya,

I've recently started using Mix locally in order to pull in Laravel Echo /w Pusher, etc. I'll be deploying soon to production (okay, well, staging first, but anyway not local).

I use Forge for deployments. What all do I need to add to my deployment script to make sure my non-local environments are happy?

Is it just an npm install and npm run production?

Are there any other gotchas I should be on the lookout for? This will be the first time I've dealt with any kind of compilation pipeline in my deployments.

0 likes
2 replies
Braunson's avatar
Braunson
Best Answer
Level 18

I typically like to update and generate a production copy of my css/js assets and commit them to my repository. So none of the npm commands are needed when deploying. However if you do want to do it on deploy, you'll want to run:

npm install && npm run production.

The only gotcha I can think about is any update issues that stop NPM from updating your dependencies. Which may not be a factory since your using npm install which installs modules that are defined in the package.json/lock (without update).

JoshP's avatar
Level 7

Ah, of course, /smh.

Stuck in the composer mindset. No npm necessary off of local.

EDIT: I do like the prodification of assets though. Perhaps it's worth it?

Please or to participate in this conversation.