I have tried
express -e myproject
However this does not work as expected
express --help
Usage: express [options] [path]
Options:
-s, --sessions add session support
-t, --template <engine> add template <engine> support (jade|ejs). default=jade
-c, --css <engine> add stylesheet <engine> support (stylus). default=plain css
-v, --version output framework version
-h, --help output help information
so, do >express -t ejs [path]
npm install -g express
express
. If you want express to make a subfolder for the project, type express appname
.npm install ejs
To configure EJS in your express project, you have to make sure you have the following line in your app.config function:
app.set('view engine', 'ejs');
EDIT: As dmh2000 pointed out, you can also just do express -t ejs
The option to use depends on the installed version of express (check express -V
!)
It was changed somewhere around version 3.0.0alpha1.
It used to be: express -t ejs
, now it is: express -e
or express --ejs
Proof (from express Git repo):
git log -S'--ejs' # Search for the change using pickaxe
git show 29508f1 # The commit
git cat-file blob 29508f1:package.json|grep version # express version
Morale: NodeJS modules are moving targets, always check their docs, especially after updating stuff.
You have installed with npm install -g express
? You need install it globally.