Jhipster 2.27:无法创建实体

时间:2016-03-08 17:02:55

标签: jhipster

我已经分叉了Jhipster 2.27,并尝试添加一个实体 哟jhipster:实体车

我收到了这个错误:

events.js:154  
      throw er; // Unhandled 'error' event  
      ^  


TypeError: Cannot read property 'endsWith' of undefined  
    at Generator.getAngularAppName   (/home/myUbuntu/dev/workspace/generator-jhipster-master/generators/generator-base.js:1223:67)  
    at module.exports.EntityGenerator.extend.initializing.getConfig (/home/myUbuntu/dev/workspace/generator-jhipster-master/generators/entity/index.js:116:40)  
    at Object.<anonymous> (/home/myUbuntu/dev/workspace/generator-jhipster-master/node_modules/yeoman-generator/lib/base.js:436:25)  
    at /home/myUbuntu/dev/workspace/generator-jhipster-master/node_modules/yeoman-generator/node_modules/run-async/index.js:24:25  
    at /home/myUbuntu/dev/workspace/generator-jhipster-master/node_modules/yeoman-generator/lib/base.js:448:8  
    at processImmediate [as _immediateCallback] (timers.js:383:17)

.yo-rc.json文件:

  GNU nano 2.4.2                                                      Fichier : .yo-rc.json                                                                                                                 

{
  "generator-jhipster": {
    "jhipsterVersion": "2.27.0",
    "baseName": "jhipster",
    "packageName": "com.myApp.testapp",
    "packageFolder": "com/myApp/testapp",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "no",
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": "no",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "rememberMeKey": "c959bf1efd5c74e68c9700e2ad012ff595ed52ec",
    "useSass": false,
    "languages": [
      "fr",
      "ca"
    ]
  },
  "testapp": {
    "jhipsterVersion": "2.27.0",
    "applicationType": "monolith",
    "baseName": "jhipster",
    "testFrameworks": [
      "gatling"
    ],
    "enableTranslation": true,
    "nativeLanguage": "fr",
    "languages": [
      "fr",
      "ca"
    ]
  }
}

知道这里出了什么问题吗?

谢谢。

[UPDATE] 这就是我所做的:

Welcome to the JHipster Generator v2.27.0
Application files will be generated in folder: /home/myUbuntu/dev/workspace/generator-jhipster-master
? (1/15) Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
? (2/15) What is the base name of your application? jhipster
? (3/15) What is your default Java package name? com.myapp.testapp
? (4/15) Which *type* of authentication would you like to use? HTTP Session Authentication (stateful, default Spring Security mechanism)
? (5/15) Which *type* of database would you like to use? SQL (H2, MySQL, PostgreSQL, Oracle)
? (6/15) Which *production* database would you like to use? MySQL
? (7/15) Which *development* database would you like to use? MySQL
? (8/15) Do you want to use Hibernate 2nd level cache? Yes, with ehcache (local cache, for a single node)
? (9/15) Do you want to use a search engine in your application? No
? (10/15) Do you want to use clustered HTTP sessions? No
? (11/15) Do you want to use WebSockets? No
? (12/15) Would you like to use Maven or Gradle for building the backend? Maven
? (13/15) Would you like to use the LibSass stylesheet preprocessor for your CSS? No
? (14/15) Would you like to enable internationalization support? Yes
? Please choose the native language of the application? French
? Please choose additional languages to install Catalan
? (15/15) Which testing frameworks would you like to use? Gatling

Installing languages: fr, ca
   create bower.json
 conflict package.json
? Overwrite package.json? overwrite
    force package.json
 conflict README.md
? Overwrite README.md? overwrite
    force README.md
 conflict .gitignore
? Overwrite .gitignore? overwrite
    force .gitignore
 conflict .gitattributes
? Overwrite .gitattributes? overwrite
    force .gitattributes
 conflict .editorconfig
? Overwrite .editorconfig? overwrite
    force .editorconfig
 conflict .travis.yml
? Overwrite .travis.yml? overwrite

然后:

  

yo jhipster:实体车

.yo-rc.json文件:   GNU nano 2.4.2 Fichier:.yo-rc.json

{
  "generator-jhipster": {
    "jhipsterVersion": "2.27.0",
    "baseName": "jhipster",
    "packageName": "com.myapp.testapp",
    "packageFolder": "com/myapp/testapp",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "no",
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": "no",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "rememberMeKey": "6b7f2e0be835e1ec6541cf6607c28d97edca19cc",
    "useSass": false,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling"
    ],
    "enableTranslation": true,
    "nativeLanguage": "fr",
    "languages": [
      "fr",
      "ca"
    ]
  }
}

UPDATE2

  

npm ERR! Linux 4.2.0-16-generic npm ERR! argv“/ usr / local / bin / node”   “/ usr / local / bin / npm”“install”npm ERR!节点v5.6.0 npm ERR! NPM   V3.6.0

     

npm ERR!未找到兼容版本:generator-jhipster@0.0.0 npm   呃!有效安装目标:npm ERR! 2.27.2,2.27.1,2.27.0,2.26.2,   2.26.1,2.26.0,2.25.0,2.24.0,2.23.1,2.23.0,2.22.0,2.21.1,2.21.0,2.20.0,2.19.0,2.18.0,2.17。 0,2.16.1,2.16.0,2.15.2,2.15.1,2.15.0,2.14.2,2.14.1,2.14.0,2.13.1,2.13.0,2.12.0,2.11.1, 2.11.0,2.10.1,2.10.0,2.9.2,2.9.1,2.9.0,2.8.0,2.7.0,2.6.0,2.5.2,2.5.1,2.5.0,2.4。 0,2.3.0,2.2.0,2.1.1,2.1.0,2.0.0,1.10.2,1.10.1,1.10.0,1.9.0,1.8.1,1.8.0,1.7.1, 1.7.0,1.6.0,1.5.0,1.4.0,1.3.0,1.2.2,1.2.1,1.2.0,1.1.1,1.1.0,1.0.0,0.18.1,0.18。 0,0.17.2,0.17.1,0.17.0,0.16.0,0.15.0,0.14.0,0.13.0,0.12.0,0.11.0,0.10.1,0.10.0,0.9.3, 0.9.2,0.9.1,0.9.0,0.8.4,0.8.3,0.8.2,0.8.1,0.8.0,0.7.1,0.7.0,0.6.2,0.6.1,0.6。 0,0.5.2,0.5.1,0.5.0,0.4.0,0.3.1,0.3.0,0.2.1,0.2.0,0.1.0,0.0.29,0.0.28,0.0.27, 0.0.26,0.0.23,0.0.22,0.0.21,0.0.20,0.0.19,0.0.18,0.0.17,0.0.16,0.0.15,0.0.14,0.0.13,0.0。 12,0.0.11,0.0.10,0.0.9,0.0.8,0.0.7,0.0.6,0.0.5,0.0.4,0.0.3,0.0.2,0.0.1 npm ERR!错误的ERR!错误的ERR!如果您需要帮助,可以报告此问题   错误:npm ERR! https://github.com/npm/npm/issues

     

npm ERR!请在任何支持请求中包含以下文件:   错误的ERR! /home/myUbuntu/dev/workspace/rhapp/npm-debug.log   module.js:341       扔错了;       ^

     

错误:找不到模块'gulp-autoprefixer'

1 个答案:

答案 0 :(得分:1)

  1. 你没有分叉JHipster 2.27,你已经分叉了JHipster 3.0 来自master(2.27在v2.x_maintenance分支上),否则你会有 没有被提议生成monolith app。
  2. 您似乎已手动修改了.yo-rc.json文件,因为JHipster拒绝com.myApp.testapp并出现此错误:“您提供的软件包名称不是有效的Java软件包名称。”
  3. 您的.yo-rc.json文件无效,不应该有此"testapp"部分,这就是失败的原因。
  4. 以下是.yo-rc.json文件的内容:

    {
      "generator-jhipster": {
        "jhipsterVersion": "2.27.0",
        "baseName": "jhipster",
        "packageName": "com.myapp.testapp",
        "packageFolder": "com/myapp/testapp",
        "authenticationType": "session",
        "hibernateCache": "ehcache",
        "clusteredHttpSession": "no",
        "websocket": "no",
        "databaseType": "sql",
        "devDatabaseType": "mysql",
        "prodDatabaseType": "mysql",
        "searchEngine": "no",
        "buildTool": "maven",
        "enableSocialSignIn": false,
        "rememberMeKey": "33cd878a5fc34f050fec62a1c0c3f4dafb64458e",
        "useSass": false,
        "applicationType": "monolith",
        "testFrameworks": [
          "gatling"
        ],
        "enableTranslation": true,
        "nativeLanguage": "fr",
        "languages": [
          "fr",
          "ca"
        ]
      }
    }
    

    更新1

    从您的跟踪中,您似乎尝试在生成器的文件夹中生成一个应用程序,这不起作用。

      

    将在文件夹中生成应用程序文件:   /家庭/ myUbuntu的/ dev /工作区/发电机-jhipster主

    您必须在新的空文件夹中运行yo jhipster

    更新2

    您的上一个错误看起来像是在package.json中更改了生成器的版本。 Npm然后在nmpjs.org上查找这个版本,但找不到它。

    更新3

    阅读我们关于如何使用分叉生成器的文档:https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md#setup