generator-jhipster: Yarn not found in generated Jenkins pipeline file

Overview of the issue

I have used the latest JHipster 4 generator to create a simple (monolithic) app, selecting angular 2 and gradle as build system. Although JHipster is really awesome I get the following error when trying to run the generated build pipeline:

:npmInstall
> hippo-4@0.0.0 postinstall /var/jenkins_home/workspace/test-pipeline 
> yarn run webpack:build
sh: 1: yarn: not found
Motivation for or Use Case

I am running jenkins 2.32, if a Jenkinsfile is generated it should work out of the box.

Reproduce the error

To reproduce you should use latests release JHipster version, create a sample project using gradle as the build tool and angular2 lib (all other options can be default). Now try to use the generated Jenkinsfile on a jenkins server where no yarn is installed, the build should fail.

Suggest a Fix
JHipster Version(s)

4.0.2

JHipster configuration
{
  "generator-jhipster": {
    "jhipsterVersion": "4.0.2",
    "baseName": "hippo4",
    "packageName": "de.joergherbst.hippo",
    "packageFolder": "de/joergherbst/hippo",
    "serverPort": "8080",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "buildTool": "gradle",
    "enableSocialSignIn": false,
    "rememberMeKey": "929ff6b80a3a4d1dbc6da49c965aeda3bd7ed2eb",
    "useSass": false,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "clientFramework": "angular2",
    "testFrameworks": [
      "gatling"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "de"
    ]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

no entity configured

Browsers and Operating System

Cause this is not an UI issue there is no browser dependency.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (12 by maintainers)

Commits related to this issue

Most upvoted comments

It’s introduced with my PR #5071
I reproduced it also with gradle in machine where yarn is not installed and node/npm/yarn are installed locally with -PnodeInstall flag: gradlew yarn_install -PnodeInstall
Fix is to use constant npm instead of <%= clientPackageManager %> in postInstall in this line https://github.com/jhipster/generator-jhipster/blob/master/generators/client/templates/angular/_package.json#L124
Currently I try to narrow problem and look for a solution (I will try gradle new node plugin with version 1.1.0).
If yarn is installed globally then I can’t reproduce this problem.