generator-jhipster: JHipster can't detect NodeJS version

Overview of the issue

JHipster fails to detect nodejs version

marek@marek-GV62-7RE:~/csdm$ ./node_modules/generator-jhipster/cli/jhipster.js INFO! Using JHipster version installed globally INFO! Running default command INFO! Executing jhipster:app INFO! Options: from-cli: true

    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝

                        https://www.jhipster.tech

Welcome to JHipster v6.9.1 Application files will be generated in folder: /home/marek/csdm


Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/ If you find JHipster useful, consider sponsoring the project at https://opencollective.com/generator-jhipster


WARNING! Your NodeJS version is too old (null). You should use at least NodeJS >=10.20.1 /home/marek/csdm/node_modules/semver/classes/semver.js:41 throw new TypeError(Invalid Version: ${version}) ^

TypeError: Invalid Version: at new SemVer (/home/marek/csdm/node_modules/semver/classes/semver.js:41:13) at compare (/home/marek/csdm/node_modules/semver/functions/compare.js:3:32) at Object.lt (/home/marek/csdm/node_modules/semver/functions/lt.js:2:29) at shelljs.exec (/home/marek/csdm/node_modules/generator-jhipster/generators/generator-base.js:1735:43) at /home/marek/csdm/node_modules/shelljs/src/exec.js:127:9 at ChildProcess.exithandler (child_process.js:301:5) at ChildProcess.emit (events.js:198:13) at maybeClose (internal/child_process.js:982:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) marek@marek-GV62-7RE:~/csdm$ node -v v10.21.0

Motivation for or Use Case

Trying to create new jhipster project fails

Reproduce the error

As in details

Related issues

N/A

Suggest a Fix

N/A

JHipster Version(s)

marek@marek-GV62-7RE:~/csdm$ ./node_modules/generator-jhipster/cli/jhipster.js info INFO! Using JHipster version installed globally INFO! Executing jhipster:info INFO! Options: from-cli: true Welcome to the JHipster Information Sub-Generator

JHipster Version(s)

cat: no such file or directory: .yo-rc.json

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

openjdk version “11.0.7” 2020-04-14 OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1) OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

git version 2.25.1

node: npm: Docker version 19.03.8, build afacb8b7f0

docker-compose version 1.25.0, build unknown

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

Ubuntu 20 LTS

  • Checking this box is mandatory (this is just to show you read everything)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

The most interesting thing for me is that jhipster lives in a denial - isn’t detecting node, although being executed by node.

checkNode tries to detect node using node -v, looks like there are something with your environment that makes the those commands node -v and npm show generator-jhipster version return incorrectly.

A fix would be to use process.versions.node instead of node -v like https://github.com/jhipster/generator-jhipster/blob/1e43348302c34855639d73587c3761d25a61a957/cli/jhipster.js#L25

and use latest-version package instead of npm show generator-jhipster version

I couldn’t reproduce:

npm -g uninstall generator-jhipster
npm install generator-jhipster@6.9.1
npx jhipster

Generated the project correctly.

$ node -v
v12.16.1
$ npm -v
6.13.4