我在终端>npm install --save express-handlebars 中运行了此命令,但仍然车把不在我的依赖项中



创建了一个app.js文件,并运行NPM install——save express-handlebars命令。我是否需要运行其他程序才能在我的包中包含车把?Json依赖?

express-handlebarshandlebars列为依赖项,因此它将被安装到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 });

最新更新