gpt4 book ai didi

angularjs - 使用 Angular-gettext 时本地 Npm 模块 "grunt-angular-gettext"未找到错误

转载 作者:行者123 更新时间:2023-12-02 23:17:16 27 4
gpt4 key购买 nike

我想使用 angular-gettext 在我的应用程序上实现 i18n,我遵循了这个 http://lostechies.com/gabrielschenker/2014/02/11/angularjspart-12-multi-language-support/我使用了这个命令:

  npm install -g grunt-cli
npm install grunt
npm install grunt-angular-gettext

我的 Gruntfile.js :

 module.exports=function(grunt){
grunt.loadNpmTasks('grunt-angular-gettext');
//This task will parse all our source files and extract the texts we want to have translated – the ones that have an associated translate directive – and add them to a so called pot file.
grunt.initConfig({
nggettext_extract:{ //we define the task name we want to configure or initialize
pot:{
files:{
'po/template.pot':['../templates/*.html'] //we want the task to parse all html files in the current directory or any sub directory of it and output the result of the task into a file called template.pot
}
}
},
nggettext_compile:{
all:{
files:{
'translations.js':['po/*.po'] //we want this task to load all po files in the subfolder po of the current directory and compile them into a resulting file translations.js located in the current directory.
}
}
}
});

}

当我使用此命令 grunt nggettext_extract 来提取翻译时,我遇到此错误:

  >> Local Npm module "grunt-angular-gettext" not found. Is it installed?
Warning: Task "nggettext_extract" not found. Use --force to continue.

Aborted due to warnings.

不知道为什么?包 grunt-angular-gettext 存在于节点模块中你能帮我解决这个问题吗?

最佳答案

尝试在您的项目文件夹中运行:

npm install grunt-angular-gettext --save-dev

我遇到了类似的问题,运行上面的命令就解决了我的问题

关于angularjs - 使用 Angular-gettext 时本地 Npm 模块 "grunt-angular-gettext"未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22249071/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com