创建了一个app.js文件,并运行NPM install——save express-handlebars命令。我是否需要运行其他程序才能在我的包中包含车把?Json依赖?
express-handlebars
将handlebars
列为依赖项,因此它将被安装到node_modules/package.json文件。
如果你想安装一个不同版本的车把,你可以通过正常的流程:
npm install --save-exact handlebars@YOUR.VERSION.HERE
你可以把这个版本的把手传递给你的exphbs()
调用来设置不同的版本:
const handlebars = require('handlebars');
const exphbs = require('express-handlebars');
const expressHandlebarsInstance = exphbs({ handlebars });