Using Visual Studio Code on MacOS "Error: No default engine was specified and no extension was provided."

Scenario/Setup:

  • MacOS High Sierra 10.13.6 with new install of VSCode 1.50.0
  • Following/running VSCode Node Tutorial from: https://code.visualstudio.com/docs/nodejs/nodejs-tutorial
  • Jump to "Express Application" section
    1. install Express as directed using npm install -g express-generator
    2. build app as directed using express myExpressApp --view pug
    3. run app using npm start but app / web server fails to run with error in terminal

Error:

Error: No default engine was specified and no extension was provided.

System Details:

  • New install of VSCode 1.50.1
    enter image description here

  • MacOS High Sierra 10.13.6
    ![enter image description here


Seems that pug view rendering engine NOT INSTALLED locally as a depency, even though I installed Express globally with npm install -g express-generator

Fix

  1. run a terminal window, or press CTRL-`(backtick) from inside of Visual Studio Code
  2. cd into your project directory/folder - or already there if launched the terminal from VSCode (previous step)... from there run these commands:
    1. install pug as a local dependency with npm install pug
    2. for EXTRA good measure, re-install express locally with: npm install express
    3. ensure all dependencies are installed and updated using: npm install
    4. relaunch your application with: npm start
    5. test/view your application at: http://localhost:3000