docker-node icon indicating copy to clipboard operation
docker-node copied to clipboard

Can't run npm 8.11.0 on Openshift/OKD

Open KingKunn opened this issue 2 years ago • 2 comments

Environment

  • OKD4.10/Openshift:
  • cri-o 1.23.0, 1.11.15
  • node16
  • node:16-alpine, node:16-bullseye-slim

Expected Behavior

npm can be executed on OKD/Openshift without root permissions

Current Behavior

Built Node16 application can't be started on OKD/Openshift platform, as npm binary or related folder/file permissions do not have enough privileges?

Possible Solution

  • Using older node:16-alpine, node:16-bullseye-slim images, where npm version is 8.5.5.
  • Remove NPM and start application via node with -> package.json start command

Steps to Reproduce

Using latest node:16-alpine, node:16-bullseye-slim images to build and run node application. Application runs on local docker container, but when deploying to OKD/Openshift... then container will crash-loop as npm command is not working properly - no output - blank row

Output in Container:

/usr/src/app $ node -v
v16.15.1
/usr/src/app $ npm -v

/usr/src/app $ npm --help

/usr/src/app $ env
...
NODE_VERSION=16.15.1
YARN_VERSION=1.22.19
...

/usr/src/app $ whoami
whoami: unknown uid 1000250000

npm command works on OKD4 when granting root permissions to the container, but this can't be used for security reasons.

Additional Information

Probably this is not my platform/image issue

KingKunn avatar Jun 09 '22 13:06 KingKunn

Having this issue as well. npm command returning nothing. Downgrade to different node version then only can uses npm. Do you have any solution?

xitox97 avatar Jun 10 '22 01:06 xitox97

This is most likely related to https://github.com/nodejs/docker-node/issues/1734 and https://github.com/npm/cli/issues/4996

soulchild avatar Jun 13 '22 06:06 soulchild