我无法安装generator-jhipster-uml来生成实体

时间:2017-02-03 00:44:54

标签: java jhipster

我正在尝试从https://jhipster.github.io/jdl-studio/生成实体(Java类),我创建jhipster-jdl.jh文件并开始生成实体。首先根据我使用的文档

yo jhipster:import-jdl my_file.jdl

生成我的实体,但是这个语句生成了一些.json文件,但我需要java类,DTO,服务和其他文件。我的朋友告诉你使用它:

yo jhipster-uml my_file.jdl

但在那之后我得到了这个错误:

Error jhipster-uml .\jhipster-jdl.jh

You don’t seem to have a generator with the name “jhipster-uml” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/gene
Install them with npm install generator-jhipster-uml.

To see all your installed generators run yo without any arguments. 

然后我尝试安装此生成器,但我收到其他错误:

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\M\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\
npm-cli.js" "install" "generator-jhipster-uml"
npm ERR! node v6.9.4
npm ERR! npm  v4.1.2
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/generator-jhipster-uml
npm ERR! 404
npm ERR! 404  'generator-jhipster-uml' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

我该怎么办?我做了文档中描述的所有内容。我使用Jhipster版本3而不是4.我应该迁移上层版本来解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

yo jhipster:import-jdl my_file.jdl应该导入JDL并为实体生成JSON文件和前端/后端文件。如果失败,请打开一个问题。

jhipster-uml不是yeoman-generator,所以你在它之前没有yo的情况下运行它。这也是安装generator-jhipster-uml失败的原因。要安装,follow the instructions in the docs

 npm install -g jhipster-uml

如果您还没有启动项目,我建议您升级到v4。如果需要,您现在仍然可以使用Angular 1.