Install APM node.js agent in Docker container using yarn

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

Kibana version:6.5.1

Elasticsearch version:6.5.1

APM Server version:6.6.1

APM Agent language and version:2.x

Browser version:Chrome 73

Original install method (e.g. download page, yum, deb, from source, etc.) and version: Docker image

Fresh install or upgraded from other version? Fresh install

Is there anything special in your setup? No aside from running this inside a docker container

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): I have a microservice running inside a Docker container using node.js. The package manager is yarn. Also, babel is included in the modules for the service. Therefore, I have attempted to install the agent inside the container using the command yarn add elastic-apm-node as part of the Docker file.
However, when I execute the docker build command to create the image, I get an error indicating the module is not compatible. Exact error message below.

The relevant piece of the Dockerfile which is creating the package dependencies and installing the required apps follows:

RUN apk --no-cache add python make g++ git curl
RUN yarn global add babel-cli
COPY package.json /app/package.json
RUN yarn add elastic-apm-node
RUN yarn install && yarn cache clean

Steps to reproduce:

  1. Execute the Docker build command

Errors in linux shell as output from build command:

error elastic-apm-http-client@7.2.2: The engine "node" is incompatible with this module. Expected version "6 || 8 || >=10".
error An unexpected error occurred: "Found incompatible module".

Provide logs and/or server output (if relevant):

Which version of Node.js does your Docker image use? From the error message you pasted, it seems like it's not one of the agent's supported versions. You can see the supported versions at the top of https://www.elastic.co/guide/en/apm/agent/nodejs/current/supported-technologies.html.

Thanks, solved by updating the node version to 10.x and adding the apm package in the package.json file. Oddly, loading the module in the Docker file did not seem to install it properly.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.