ProductionMode failing on BitBucket; yarn can not be executed

Hello,

I am quite new to Vaadin and now trying to bring my first project “into production”.
Locally (on a Windows machine) it does build, since there is no real Access Management.

On the BitBucket agent, an error is thrown because the successfully installed yarn can not be executed (Permission denied).

The relevant Part of the Maven output is attached at the end.

Did anyone face the same issue or can recomment a solution? Maybe a certain Docker Image to use as build agend?

Regards,
Daniel

-----DEBUG-----------

[INFO]
Unpacking /opt/atlassian/pipelines/agent/build/target/cache/yarn-v1.6.0.tar.gz into /opt/atlassian/pipelines/agent/build/target/node/yarn
[INFO]
Installed Yarn locally.
[INFO]
Running ‘yarn install’ in /opt/atlassian/pipelines/agent/build/target
[ERROR]
/opt/atlassian/pipelines/agent/build/target/node/yarn/dist/bin/yarn: exec: line 31: node: Permission denied
[INFO]

[INFO]
BUILD FAILURE
[INFO]

[INFO]
Total time: 26.930 s
[INFO]
Finished at: 2018-10-19T22:51:33Z
[INFO]

[ERROR]
Failed to execute goal com.vaadin:vaadin-maven-plugin:10.0.4:package-for-production (default) on project hoffice: Execution default of goal com.vaadin:vaadin-maven-plugin:10.0.4:package-for-production failed: Failed to install required frontend dependencies: ‘yarn install’ failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 126 (Exit value: 126) → [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.vaadin:vaadin-maven-plugin:10.0.4:package-for-production (default) on project hoffice: Execution default of goal com.vaadin:vaadin-maven-plugin:10.0.4:package-for-production failed: Failed to install required frontend dependencies
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)

SHORT: How do I set “original.frontend.resources=true” using vaadin with spring boot?

LONG:
Okay now I am stuck.

The Maven goal package-for-production of the vaadin-maven-plugin does not build in bitbucket because of the error given above.
This might be related to the discussion [here]
(https://github.com/eirslett/frontend-maven-plugin/issues/743)

I was unable to get it to work with a custom pipeline, that should replace the maven goal.
I don’t understand where the package.json used by yarn is coming from.

But finally i found out that i can enable the Production Mode via config files (It is a spring boot project) setting both(!):
vaadin:
productionMode: true
servlet:
productionMode: true

Good, now i have the production mode enabled - but I can not access the page because of the following problem:

“There was an unexpected error (type=Internal Server Error, status=500).
Failed to find the bundle manifest file ‘frontend://vaadin-flow-bundle-manifest.json’ in the servlet context for ‘ES6’ browsers. If you are running a dev-mode servlet container in maven e.g. jetty:run change it to jetty:run-exploded. If you are not compiling frontend resources, include the ‘vaadin-maven-plugin’ in your build script. Otherwise, you can skip this error either by disabling production mode, or by setting the servlet parameter ‘original.frontend.resources=true’.”

This seems kind of intended since i skipped the frontend packaging, however - none of the suggested solutions seem to work:
- The vaadin-maven-plugin (i.e. the required step, that i am missing) causes the pipeline to fail.
- Disabling production mode is no option since that’s exactly what I wanted to change
- I did not find any place to set those parameters using vaadin with spring boot.

Please find the YAML file I had used to deploy Vaadin app to Apache Tomcat:

# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3.6.3-jdk-8

pipelines:
  branches:
    deployment:       
    - step:
        name: Building WAR File
        caches:
          - maven
        script:
          - echo "Node Install :"
          - apt-get update
          - apt-get -y install nodejs
          - apt-get -y install npm
          - mvn -Pproduction -B clean verify package
        artifacts:
          - target/admin-app.war
    - step:
           name: Deploy to production
           deployment: production
           script:
             - echo "Deploying to production environment"
             - pipe: atlassian/scp-deploy:0.3.10
               variables:
                 USER: $TOMCAT_SERVER_USER
                 SERVER: $TOMCAT_SERVER_ADDRESS
                 REMOTE_PATH: '/opt/tomcat/latest/webapps'
                 LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/target/admin-app.war'
                 DEBUG: 'true'
             - pipe: atlassian/slack-notify:0.3.4
               variables:
                 WEBHOOK_URL: 'https://hooks.slack.com/services/'
                 MESSAGE: 'New Admin App has been deployed after the commit'
                 DEBUG: 'true'