Published on

Open Files in Your Editor at a Specific Line and Column in Node.js


Open files at a specific column and line in your favourite editor (or default editor) could be a great help especially when trying to debug things or just improving your developer experience for a large project that you're working on.

In Next.js we can easily do that with the help of open-editor NPM package.

Here is how to do it:


npm install open-editor


import openEditor from 'open-editor';

      file: "package.json",
      line: 3,
      column: 2,
    // Set an editor explicitly. 
    // By default, it is auto-deduced based on the $EDITOR environment variable.
    editor: "code", 

Happy opening files!