question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Yarn not found in generated Jenkins pipeline file

See original GitHub issue
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.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kaidohallikcommented, Feb 12, 2017

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.

0reactions
gmarzioucommented, Jul 13, 2019

@AllenJol Could you post your Jenkinsfile here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jenkins Pipeline "yarn install" command not found
There is no yarn command in your PATH variable. Do npm install -g yarn before stage('Prepare') { sh "npm install -g yarn" sh...
Read more >
Jenkins Shell script not working. Yarn: command not found
1 Answer 1 · Install Yarn · Check it's on Jenkins' $PATH, or provide the full path in the script (e.g. /usr/bin/yarn )....
Read more >
NPM and Yarn Wrapper and Steps - Jenkins Plugins
This is a pipeline-friendly Jenkins plugin that provides an npm wrapper, a yarn wrapper and npm and yarn build steps for Unix systems....
Read more >
Configure and use Yarn with CodeArtifact - AWS Documentation
You can use the yarn config list command to check that Yarn is using the correct configuration. After running the command, check the...
Read more >
Running tests and creating code coverage reports for React ...
Step 2: Create a Jenkins pipeline file ... The line calling junit will publish the report that npm run test created (see previous...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found