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
- install Express as directed using
npm install -g express-generator
- build app as directed using
express myExpressApp --view pug
- run app using
npm start
but app / web server fails to run with error in terminal
- install Express as directed using
Error:
Error: No default engine was specified and no extension was provided.
System Details:
-
New install of VSCode 1.50.1
-
MacOS High Sierra 10.13.6
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
- run a terminal window, or press
CTRL-`
(backtick) from inside of Visual Studio Code -
cd
into your project directory/folder - or already there if launched the terminal from VSCode (previous step)... from there run these commands:- install pug as a local dependency with
npm install pug
- for EXTRA good measure, re-install express locally with:
npm install express
- ensure all dependencies are installed and updated using:
npm install
- relaunch your application with:
npm start
- test/view your application at: http://localhost:3000
- install pug as a local dependency with