All threads / How do I deploy webpacker with nvm with capistrano?

Ask A Question


You’re not receiving notifications from this thread.

How do I deploy webpacker with nvm with capistrano?

M D asked in Rails


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.

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.

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?

Join the discussion

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.