Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
process.env.npm_package_version undefined when running inside docker container

I am trying to print the current package.json version inside my node.js app. When I run it locally it works fine using process.env.npm_package_version.

However when I build it using a Dockerfile and then deploying it to a container the process.env.npm_package_version variable is undefined. Does anyone know what is going on?

My dockerfile:

FROM node:16.13.2
ENV NODE_ENV production
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
CMD ["npm", "start"]

Part of my package.json:

"name": "node-discord-bot",
"version": "2.2.4",
"description": "",
"main": "./build/server.js",
"scripts": {
  "start": "node .",
  "test": "echo \"Error: no test specified\" && exit 1",
  "build": "tsc"
},
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!