jhipster应用程序部署到Heroku时出错

时间:2018-02-15 17:00:16

标签: java maven heroku jhipster heroku-toolbelt

我正在尝试使用ubuntu将我的jhipster生成的应用程序部署到heroku。当我输入:

echo $JAVA_HOME

,我得到了/usr/lib/jvm/java-8-oracle

但是在使用jhipster命令将应用程序部署到heroku时,我收到以下错误。

    sudo jhipster heroku


Using JHipster version installed locally in current project's node_modules
Executing jhipster:heroku
Options: 
Heroku configuration is starting
Deploying as existing app: infinite-savannah-43112

Using existing Git repository

Heroku CLI deployment plugin already installed

Provisioning addons
No new addons created

Creating Heroku deployment files
identical src/main/resources/config/bootstrap-heroku.yml
identical src/main/resources/config/application-heroku.yml
identical Procfile
identical pom.xml
identical pom.xml

Building application
✖ { Error: Command failed: ./mvnw verify -DskipTests=true -B -Pprod
Error: JAVA_HOME is not defined correctly.
  We cannot execute /usr/lib/jvm/java-9-openjdk-amd64/bin/java/bin/java

    at ChildProcess.exithandler (child_process.js:272:12)
    at ChildProcess.emit (events.js:160:13)
    at maybeClose (internal/child_process.js:943:16)
    at Socket.stream.socket.on (internal/child_process.js:363:11)
    at Socket.emit (events.js:160:13)
    at Pipe._handle.close [as _onclose] (net.js:562:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: './mvnw verify -DskipTests=true -B -Pprod' }
Congratulations, JHipster execution is complete!

即使我的JAVA_HOME指向Java-8-oracle,为什么jhipster抛出错误说JAVA_HOME指向别的东西并且任何修复

2 个答案:

答案 0 :(得分:3)

如果您手动将-rw------- 1 root whoopsie 285383602 Feb 16 07:17/var/crash/201802160716/dump.201802160716 中的herokuDeployType值修改为:

.yo-rc.json

然后,下次运行"herokuDeployType": "git" 时,它将在Heroku上运行Maven。

答案 1 :(得分:1)

您正在使用不受JHipster支持的JDK 9。你不应该使用sudo,它非常不安全。我假设您将Node安装为sudo,您应该考虑正确地重新安装Node(可能使用nvm)并更改项目文件的所有权。您的错误可能来自sudo命令。