Use node.js as the default application for opening .js files

I'd like to set node.js as the default application on Ubuntu for opening .js files. How can this be done? Ideally, I'd like to be able to start a node.js server simply by double-clicking on a .js file, instead of navigating to the script's folder from the terminal and then typing "node name_of_script.js".

1 Answer

Right-click on a .js file, open its properties, add node.js as an Open With application, and select it as the default.

EDIT:

It seems that newer versions of some DEs (yes GNOME, I'm looking at YOU...) have removed the option to do this. Using xdg-mime from the command line will tell you how to write the appropriate XML file to associate the application with the filetype, and how to associate it. See xdg-mime --manual for details.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like