Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I deploy webpacker with nvm with capistrano?

M D asked in Rails

Hi,

Was following your tutorial for capistrano but did not see any webpacker in there :(.

Right now I am having a problem that cap seems to be finding my old node version before I installed nvm and upgraded node.

Tried using capistrano-nvm gem, and getting an error nvm: v14.2.0 is not installed or not foundnvm: v14.2.0 is not installed or not found

I can find it in cd /root/.nvm/versions/node/v14.2.0/bin.

Should I just scratch nvm and update node the old fashioned way? Kind of don't want to mess anything up on production!

Thanks so much for your amazing tutorials and this really helpful forum.

Reply

There's nothing special you need to do for deploying Webpacker with Capistrano as it's built-in to the Rails assets:precompile step. The only thing you need to do is make sure that NodeJS is installed and in your PATH when deploying.

You don't want to install NVM as the root user. It should be on the deploy user, same as rbenv. Your code always runs and deploys under the deploy user so you want to avoid root.

Reply

Hey there!

I have been trying to solve this for 5+ hours at this point. M D - did you ever figure out a solution here?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.