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



我正试图遵循jhipster的官方安装说明http://jhipster.github.io/installation.html我正在尝试安装Docker。我使用的是Linux Mint 17.1,并安装了docker(docker版本1.0.1,构建990021a)

我已经成功地提取了docker容器,使用提供的命令运行容器,并将ssh放入容器中。

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

我不清楚这个例外是从哪里来的,也不清楚该怎么解决。官方文件中没有提到任何关于这个问题的内容,我也找不到关于这个确切问题的任何其他报告。

我相信,无论是什么原因导致了这个异常,当我尝试启动项目时,似乎也会引发问题。我使用"mvn-spring-boot:run",应用程序似乎正在运行,但当我尝试访问网页时,我看不到任何正常生成的"默认"应用程序。相反,我看到的只是页面标题为"jhipster",页面上唯一的文字是"这是你的页脚"

以下是"yo-jhipster"命令的输出(其中一些"创建"消息被编辑为空格)

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$ 

这似乎是JHipster Dockerfile的一个错误。我今天提交了一个pull请求,其中更新了节点版本。有了更新的节点版本,就没有问题了。

你有两个选择:

  1. 等待这个pull请求被合并,这可能不会超过一两天,这将触发对DockerHub上JHipster Docker映像的更新
  2. 从我的分叉存储库下载Dockerfile,并在与Dockerfile 相同的目录中使用以下命令自己构建映像

    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文档页面。

看看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缓存清理"并运行">yo-jhipster"。。它应该起作用。

最新更新