Meteor comes bundled with a specific node executable. This is very handy because it relieves you from setting up a complex environment but provides everything out of the box.
However, sometimes you may have to reference to the underlying node executable. An example would be to enable linting in your IDE or editor. It may not only require the lint config, but also the path to the executable in order to run.
But how to find your current node executable easy and fast (and reliable)?
Fortunately, node’s process environment has an attribute, called execPath, which prints the current (full specified) path the executable.
But you don’t need to create and run a new application to use it. When running
node in the console without targeting a js file, it starts the interactive console. This lets you dynamically interact with the node environment and thus get the value of
Because the node executable comes shipped with Meteor, you can just execute it using the meteor command:
$ meteor node >
The greater-than character symbolizes the interactive shell. Now you can log the value of
process.execPath to the console:
$ meteor node > console.log(process.execPath) /home/username/.meteor/packages/meteor-tool/.1.6.1_1.1qiqji2.y00v++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node
As you can see is the greatest advantage of this method, that the path you receive is not only the valid path to your node executable but also referring to the executable of the Meteor version, that is currently in use.
This comes in handy when there are multiple Meteor versions (and thus multiple node versions installed).