Everybody knows Meteor uses NodeJS behind the scene. But does it use NodeJS version in your PATH?
Meteor is ultra portable and the developer does not need to know about NodeJS at all. So when you are installing Meteor, it will download something called
dev_bundle which has NodeJS and all the NPM modules needed by Meteor. All these modules are pre-compiled for your platform. That makes getting started with Meteor easier and quicker.
No. This is perfect. But problems arise when you are bundling an app and try to run it somewhere else or even on the same machine.
If you’ve used any binary NPM module such as
usage, you might need to re-install those modules again. This is obviously not very good.
What’s more, you may also need to re-install
You might also come across some errors not detected on the dev machine. The reason is the node version Meteor uses and the version in your PATH is not the same.
Follow these steps.
Doing that, we can avoid re-installing binary NPM modules after the bundling process. We will be using the same node version used by Meteor and as a result, we can expect the same behavior as if it was running on the dev machine.
Step #1 seems OK. But how about #2? How do I find the node version used by Meteor?
I’ve 2 answers: One short and one long. Let’s start with the short one. Life’s too short for long answers.
So I’ve created a simple tool called mnode, which shows you the path to the NodeJS binary used by Meteor. Let’s install it.
sudo npm install -g mnode
mnodeand you can get the full path of the NodeJS binary
This project is on github and it is quite small. Read it.
If you need to some help on deploying or scaling your app, Talk to me.
Alright, you want know how to do it yourself. Let me guide you.
If your app is using a custom git checkout with meteorite, you can’t apply this solution to it. Read the source of
mnodeand see what’s happening there.
./.meteor/release, let’s call it as
tools, let’s call it
Hope this helps you to deploy and run your app smoothly without much issues. Let me know your thoughts.
Thank You, Aloka Gunasekara for editing the article.