无法使用 Docker 图像和安装说明成功创建 jhipster 项目

Unable to successfully create jhipster project using Docker image and install instructions

我正在尝试按照 http://jhipster.github.io/installation.html 的官方 jhipster 安装说明进行操作 我正在尝试进行 Docker 安装。我正在使用 Linux Mint 17.1 并安装了 docker(Docker 版本 1.0.1,内部版本 990021a)

我已成功拉取 docker 容器,运行 使用提供的命令将容器拉入容器,并通过 ssh 进入容器。

但是,当我尝试 运行 "yo jhipster" 时,我 运行 遇到了问题。它会提示我标准生成器问题,然后成功创建项目本身所需的所有文件。在生成器接近尾声时,在安装了一些 npm 之后,我最终收到一条错误消息,然后是异常。

我不清楚这个异常是从哪里来的,也不清楚如何解决它。官方文档没有提及任何有关此问题的信息,我也无法找到有关此确切问题的任何其他报告。

我相信导致此异常的原因似乎也会在我尝试启动项目时引起问题。我使用 "mvn spring-boot:run" 并且应用程序显示为 运行,但是当我尝试访问该网页时,我没有看到任何我期望的正常生成的 'default' 应用程序。相反,我所看到的只是页面标题 "jhipster" 和页面本身的唯一文本 "This is your footer"

下面是 "yo jhipster" 命令的输出(为 space 编辑了一些 'create' 消息)

jhipster@234b4f2192fd:/jhipster$ yo jhipster

 _     _   ___   __  _____  ____  ___       __  _____   __    __    _    
| |_| | | | |_) ( (`  | |  | |_  | |_)     ( (`  | |   / /\  / /`  | |_/ 
|_| | |_| |_|   _)_)  |_|  |_|__ |_| \     _)_)  |_|  /_/--\ \_\_, |_| \ 
                         ____  ___   ___                             
                        | |_  / / \ | |_)                            
                        |_|   \_\_/ |_| \                            
          _    __    _       __        ___   ____  _      __        
         | |  / /\  \ \  /  / /\      | | \ | |_  \ \  / ( (`       
       \_|_| /_/--\  \_\/  /_/--\     |_|_/ |_|__  \_\/  _)_)       


Welcome to the JHipster Generator

This is an existing project, using the configuration from your .yo-rc.json file 
to re-generate the project...

create package.json
create bower.json
create README.md
identical .bowerrc
identical .gitignore
identical .gitattributes
create Gruntfile.js
create pom.xml
..........
create src/main/webapp/assets/images/development_ribbon.png
create src/main/webapp/assets/images/hipster.png
create src/main/webapp/assets/images/hipster2x.png
create src/main/webapp/index.html
identical .editorconfig
identical .jshintrc


I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.


npm WARN engine imagemin@3.1.0: wanted: {"node":">=0.10.0","npm":">=2.1.5"} (current: {"node":"0.10.33","npm":"1.4.28"})
npm WARN optional dep failed, continuing fsevents@0.3.5

> phantomjs@1.9.15 install /jhipster/node_modules/karma-phantomjs-launcher/node_modules/phantomjs
> node install.js

Download already available at /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Extracting tar contents (via spawned process)
Removing /jhipster/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1425335692414/phantomjs-1.9.8-linux-x86_64 -> /jhipster/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /jhipster/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs

> ws@0.5.0 install /jhipster/node_modules/grunt-browser-sync/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)


> ws@0.4.31 install /jhipster/node_modules/grunt-browser-sync/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)


> ws@0.4.32 install /jhipster/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

npm WARN optional dep failed, continuing imagemin-optipng@4.2.0
npm WARN optional dep failed, continuing imagemin-gifsicle@4.1.0
npm WARN optional dep failed, continuing imagemin-jpegtran@4.1.0
npm WARN optional dep failed, continuing imagemin-pngquant@4.0.0
npm WARN prefer global yo@1.3.3 should be installed with -g

> yo@1.3.3 postinstall /jhipster/node_modules/yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

✔ No .bowerrc file in home directory
✔ Global configuration file is valid
✔ No .yo-rc.json file in home directory
✔ NODE_PATH matches the npm root

Everything looks all right!
npm ERR! EEXIST, open '/home/jhipster/.npm/ebc17495-r-npm-minimist-1-1-0-package-tgz.lock'
File exists: /home/jhipster/.npm/ebc17495-r-npm-minimist-1-1-0-package-tgz.lock
Move it away, and try again. 

npm ERR! System Linux 3.13.0-37-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /jhipster
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /home/jhipster/.npm/ebc17495-r-npm-minimist-1-1-0-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
    npm ERR! not ok code 0

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)

jhipster@234b4f2192fd:/jhipster$ 

看看 yo jhipster 命令中的这些行

npm ERR! EEXIST, open '/home/jhipster/.npm/ebc17495-r-npm-minimist-1-1-0-   package-tgz.lock'
File exists: /home/jhipster/.npm/ebc17495-r-npm-minimist-1-1-0-package-tgz.lock
Move it away, and try again.

所以删除.lock文件再试

尝试“>npm cache clean”和运行“>yo jhipster”..它应该可以工作。

这似乎是 JHipster Docker文件的错误。我今天提交了一个pull request,其中更新了节点版本。使用更新的节点版本就没有问题了。

您有两个选择:

  1. 等待合并此拉取请求,这可能不会超过一两天,这将触发对 DockerHub 上的 JHipster Docker 图像的更新
  2. 从我的 forked repository 下载 Docker 文件,并在与 Docker 文件

    相同的目录中使用以下命令自行构建映像]
    docker build -t yourusername/jhipster-docker .
    sudo docker run -v ~/jhipster:/jhipster -p 8080:8080 -p 9000:9000 -p 35729:35729 -p 4022:22 -t yourusername/jhipster-docker 
    

这个 docker 运行 命令取自您之前提到的 JHipster documentation 页面。