Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在CentOS 7上安装JHipster_Java_Node.js_Jhipster_Centos7 - Fatal编程技术网

Java 无法在CentOS 7上安装JHipster

Java 无法在CentOS 7上安装JHipster,java,node.js,jhipster,centos7,Java,Node.js,Jhipster,Centos7,OS:CentOS 7(CentOS-release-7-7.1908.0.el7.CentOS.x86_64) 注意:此操作系统是在Oracle VirtualBox 6.0中运行的虚拟机 我一直遵循JHipster安装页面()提供的说明 我通过yum安装了OpenJDK 11: > sudo yum install java-11-openjdk ... > java -version openjdk version "11.0.4" 2019-07-16 LTS OpenJDK

OS:CentOS 7(CentOS-release-7-7.1908.0.el7.CentOS.x86_64)

注意:此操作系统是在Oracle VirtualBox 6.0中运行的虚拟机

我一直遵循JHipster安装页面()提供的说明

我通过yum安装了OpenJDK 11:

> sudo yum install java-11-openjdk
...
> java -version
openjdk version "11.0.4" 2019-07-16 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.4+11-LTS)
然后我通过yum安装了nodejs:

> sudo yum install nodejs
这安装了以下组件:

> node –v
v6.17.1
> npm –v
3.10.10
[jgagnon@centos7-1 ~]$ sudo npm install -g generator-jhipster
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/usr/bin/jhipster -> /usr/lib/node_modules/generator-jhipster/cli/jhipster.js

> core-js@3.3.2 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/core-js
> node postinstall || echo "ignore"


> spawn-sync@1.0.15 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/spawn-sync
> node postinstall


> yo@3.1.0 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/yo
> yodoctor

/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-doctor/lib/index.js:12
  (async () => {
         ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-doctor/lib/cli.js:3:1)
/usr/lib
└── (empty)

npm ERR! Linux 3.10.0-1062.1.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install" "-g" "generator-jhipster"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! yo@3.1.0 postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the yo@3.1.0 postinstall script 'yodoctor'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     yodoctor
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs yo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/jgagnon/npm-debug.log
npm ERR! code 1
然后,我尝试安装Jhister:

> sudo npm install –g generator-jhipster
这产生了以下结果:

> node –v
v6.17.1
> npm –v
3.10.10
[jgagnon@centos7-1 ~]$ sudo npm install -g generator-jhipster
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/usr/bin/jhipster -> /usr/lib/node_modules/generator-jhipster/cli/jhipster.js

> core-js@3.3.2 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/core-js
> node postinstall || echo "ignore"


> spawn-sync@1.0.15 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/spawn-sync
> node postinstall


> yo@3.1.0 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/yo
> yodoctor

/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-doctor/lib/index.js:12
  (async () => {
         ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster/node_modules/yeoman-doctor/lib/cli.js:3:1)
/usr/lib
└── (empty)

npm ERR! Linux 3.10.0-1062.1.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install" "-g" "generator-jhipster"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! yo@3.1.0 postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the yo@3.1.0 postinstall script 'yodoctor'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     yodoctor
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs yo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/jgagnon/npm-debug.log
npm ERR! code 1
注意:根据jhipster运行(如下所示),node.js的安装版本不是LTS(无论这意味着什么)。它将显示一条警告消息并继续

有人知道Node.js作为LTS的重要性吗?如果有必要,我如何获得Node.js的最新LTS版本

尝试安装JHipster:

[jgagnon@centos7-1 ~]$ sudo npm install -g generator-jhipster
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/usr/bin/jhipster -> /usr/lib/node_modules/generator-jhipster/cli/jhipster.js

> core-js@3.3.2 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/core-js
> node postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> spawn-sync@1.0.15 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/spawn-sync
> node postinstall


> yo@3.1.0 postinstall /usr/lib/node_modules/generator-jhipster/node_modules/yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

✔ No .bowerrc file in home directory
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ No .yo-rc.json file in home directory
✔ Node.js version
✔ npm version
ErrorClass [RequestError]: connect ETIMEDOUT 104.16.27.35:443
    at ClientRequest.<anonymous> (/usr/lib/node_modules/generator-jhipster/node_modules/latest-version/node_modules/got/index.js:73:21)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:210:5)
    at TLSSocket.socketErrorListener (_http_client.js:406:9)
    at TLSSocket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ETIMEDOUT',
  message: 'connect ETIMEDOUT 104.16.27.35:443',
  host: 'registry.npmjs.org',
  hostname: 'registry.npmjs.org',
  method: 'GET',
  path: '/yo'
}
✖ yo version
ErrorClass [RequestError]: connect ETIMEDOUT 104.16.27.35:443
    at ClientRequest.<anonymous> (/usr/lib/node_modules/generator-jhipster/node_modules/latest-version/node_modules/got/index.js:73:21)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:210:5)
    at TLSSocket.socketErrorListener (_http_client.js:406:9)
    at TLSSocket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ETIMEDOUT',
  message: 'connect ETIMEDOUT 104.16.27.35:443',
  host: 'registry.npmjs.org',
  hostname: 'registry.npmjs.org',
  method: 'GET',
  path: '/yo'
}

Found potential issues on your machine :(
+ generator-jhipster@6.4.1
added 782 packages from 414 contributors in 937.516s

这里发生了很多事情,警告和失败信息并没有给我足够的信心。我将尝试运行生成的任何东西并与之交互。

我终于想出了如何成功安装Jhister(用于我的系统和配置)

我需要将maven更新到一个更新的版本(3.6.2)。 我需要设置环境变量MAVEN_OPTS来定义MAVEN/mvnw需要的代理参数:http.proxyHost、http.proxyPort、https.proxyHost和https.proxyPort


一旦完成,我就能够成功安装JHipster并使用它生成。

LTS意味着长期支持,它意味着基本上是一个稳定的NodeJS版本。目前JHipster在构建时指定的版本是10.16.3,但您应该可以使用任何10.xApparently,我已经安装了12.11.1,但它不是LTS。JHipster警告它不是LTS。在CentOS 7上,我使用“nvm”(节点版本管理器)安装/使用/切换节点版本,因此我独立于CentOS软件包。这是在用户空间中运行的,所以如果CentOS本身需要Node.js,或者有一天会需要它,那么nvm应该不会有问题。请看“是”,使用nvm是一种很好的做法。nvm允许您安装给定软件包的任何可用版本吗?