Ben Elferink
Ben Elferink

Reputation: 53

node-tflite - GLIBC_2.27 not found (required by libtensorflowlite_c.so)

I am trying to deploy a Node.js server to IBM cloud (Linux) using node-tflite as a dependency, and get the following error preventing the server from starting:

un 9 17:04:57 Code Engine deployment-0001 /usr/src/app/node_modules/bindings/bindings.js:121
        throw e;
        ^ 
Jun 9 17:04:57 Code Engine deployment-0001 Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /usr/src/app/node_modules/node-tflite/build/Release/libtensorflowlite_c.so)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1127:18)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at bindings (/usr/src/app/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/usr/src/app/node_modules/node-tflite/index.js:4:32)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32) 
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR! code ELIFECYCLE 
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR! errno 1 
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR! [email protected] start: `nodemon index.js || node index.js` 
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR! Exit status 1 
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR!  
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR! Failed at the [email protected] start script. 
Jun 9 17:04:57 Code Engine deployment-0001 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 
Jun 9 17:04:57 Code Engine deployment-0001 aggressive probe error (failed 202 times): dial tcp 127.0.0.1:9000: connect: connection refused

This is what my package.json looks like:

{
  "name": "sp-streamer",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "nodemon index.js || node index.js"
  },
  "license": "ISC",
  "dependencies": {
    "csv-parser": "^3.0.0",
    "dotenv": "^10.0.0",
    "express": "^4.17.1",
    "fs": "^0.0.1-security",
    "mathjs": "^9.4.2",
    "node-tflite": "^0.0.2",
    "os-utils": "^0.0.14",
    "socket.io-client": "^4.1.2"
  }
}

And I have a dockerfile as well:

FROM node:14

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install
COPY . .

EXPOSE 9000
CMD [ "npm", "start" ]

And the following is a .gitlab-ci.yml:

stages:
  - build
docker-build:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  script:
    - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
    - docker push "$CI_REGISTRY_IMAGE${tag}"

How can I get the missing /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.27 not found?

Upvotes: 0

Views: 3011

Answers (1)

Ben Elferink
Ben Elferink

Reputation: 53

Found the solution, works for sure on deployment, this is the dockerfile:

FROM ubuntu

RUN apt-get update
RUN apt-get install -y curl wget make g++
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs

COPY package*.json ./
RUN npm install
COPY . .

EXPOSE 9007
CMD [ "npm", "start" ]

Upvotes: 1

Related Questions