Yeoman 生成器抛出错误 "Object has no method 'templatePath'"
Yeoman generator throws the error "Object has no method 'templatePath'"
我开始创建自己的 yeoman 生成器。
根据这个article,我想写一些内容到html文件。我使用以下代码:
writing: function() {
this.fs.copyTpl(
this.templatePath("index.html"),
this.destinationPath("public/index.html"),
{ title: "My template" }
);
}
但是当我 运行 我的发电机时,我有错误:TypeError: Object [object Object] has no method 'templatePath'
我的 yeoman 版本是 1.4.7,yeoman-generator 版本是 0.17.7
此方法仅从 yeoman-generator 0.18
开始可用。更新您正在使用的版本。
我开始创建自己的 yeoman 生成器。
根据这个article,我想写一些内容到html文件。我使用以下代码:
writing: function() {
this.fs.copyTpl(
this.templatePath("index.html"),
this.destinationPath("public/index.html"),
{ title: "My template" }
);
}
但是当我 运行 我的发电机时,我有错误:TypeError: Object [object Object] has no method 'templatePath'
我的 yeoman 版本是 1.4.7,yeoman-generator 版本是 0.17.7
此方法仅从 yeoman-generator 0.18
开始可用。更新您正在使用的版本。