appsody / stacks

Appsody application stacks. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
90 stars 120 forks source link

Why appsody stack package command fail to npm install ? #931

Open usman10scorpio opened 2 years ago

usman10scorpio commented 2 years ago

In my project I am doing appsody stack package in the last steps where I am doing npm install it gets failed.

Below is my docker-stack file in image folder of my appsody stack.

FROM registry.access.redhat.com/ubi8/nodejs-12:1-95

LABEL vendor="Kabanero" \
    name="kabanero/nodejs-express" \
    version="0.4.8" \
    summary="Image for Kabanero Node.js Express development" \
    description="This image contains the Kabanero development stack for the Nodejs Express collection"

USER root
RUN yum install --disableplugin=subscription-manager python2 -y
RUN ln -s /usr/bin/python2 /usr/bin/python

ENV APPSODY_PROJECT_DIR=/project
ENV APPSODY_MOUNTS=/:/project/user-app
ENV APPSODY_DEPS=/project/user-app/node_modules

ENV APPSODY_WATCH_DIR=/project/user-app/src
ENV APPSODY_WATCH_IGNORE_DIR=/project/user-app/node_modules
ENV APPSODY_WATCH_REGEX="^.*.js$"

ENV APPSODY_PREP="npm install --prefix user-app && npm run build --prefix user-app"

ENV APPSODY_RUN="npm start"
ENV APPSODY_RUN_ON_CHANGE="npm run build --prefix user-app && npm start"
ENV APPSODY_RUN_KILL=true

ENV APPSODY_DEBUG="npm run debug"
ENV APPSODY_DEBUG_ON_CHANGE="npm run build --prefix user-app && npm run debug"
ENV APPSODY_DEBUG_KILL=true

ENV APPSODY_TEST="npm test --prefix user-app"
ENV APPSODY_TEST_ON_CHANGE=""
ENV APPSODY_TEST_KILL=false

COPY ./LICENSE /licenses/
COPY ./project /project
COPY ./config /config

RUN chown -R default:root /project
WORKDIR /project
USER default
RUN mkdir -p /project/user-app/node_modules
RUN npm install

ENV PORT=3000
ENV NODE_PATH=/project/user-app/node_modules

EXPOSE 3000
EXPOSE 9229

Below is the output on iTerm

`[Docker] #1 [internal] load build definition from Dockerfile-stack
[Docker] #1 sha256:71ae3aa59d1d0f01335565099974b8bac15c2b881778a2ef94ab0836b5532d22
[Docker] #1 transferring dockerfile: 1.56kB done
[Docker] #1 DONE 0.0s
[Docker]
[Docker] #2 [internal] load .dockerignore
[Docker] #2 sha256:958a73c00de5d068ae16c4666de62a63ddc7d861e2e597d56ddaf51b57c3ae71
[Docker] #2 transferring context: 88B done
[Docker] #2 DONE 0.0s
[Docker]
[Docker] #3 [internal] load metadata for registry.access.redhat.com/ubi8/nodejs-12:1-95
[Docker] #3 sha256:295d4a8db19d809023ab606961b2258e8f74e25b487b85225aad630fc42c9a10
[Docker] #3 DONE 1.4s
[Docker]
[Docker] #4 [ 1/10] FROM registry.access.redhat.com/ubi8/nodejs-12:1-95@sha256:6aaecf0f27f4237e79a56ad668eb839d7053c52a93e4f2081699dd5774059744
[Docker] #4 sha256:7a476dba8d210c17c32248fed060c7c5502a0e7e9582912bf234628afb93d836
[Docker] #4 DONE 0.0s
[Docker]
[Docker] #7 [internal] load build context
[Docker] #7 sha256:02d31b273d7e25b694a6055d7fcf6dde985056e49489e59677f4c929d60fafb4
[Docker] #7 transferring context: 131.03kB done
[Docker] #7 DONE 0.0s
[Docker]
[Docker] #11 [ 7/10] RUN chown -R default:root /project
[Docker] #11 sha256:aa5f791e94b5db43764e28a9baf7e99bec6c488d6ff40027f3a56ee118ee38af
[Docker] #11 CACHED
[Docker]
[Docker] #9 [ 5/10] COPY ./project /project
[Docker] #9 sha256:76aa297e14757ccec72a86ad16b86446cf268c3495b39e51ee345ffa33018e7a
[Docker] #9 CACHED
[Docker]
[Docker] #6 [ 3/10] RUN ln -s /usr/bin/python2 /usr/bin/python
[Docker] #6 sha256:8aaca063c1ec6cebbfec9bd7bfc52fc04aea82b8135f3c31270b9a40a64d0c34
[Docker] #6 CACHED
[Docker]
[Docker] #8 [ 4/10] COPY ./LICENSE /licenses/
[Docker] #8 sha256:be6a93f601b529702a978bba7275fa29aa82178b7e8adb0a5e9121faf28074f6
[Docker] #8 CACHED
[Docker]
[Docker] #10 [ 6/10] COPY ./config /config
[Docker] #10 sha256:5d542ea3fd57a19ea43ad13e732c4c02fe92d8517655fa2df3d84f42b8207c5f
[Docker] #10 CACHED
[Docker]
[Docker] #5 [ 2/10] RUN yum install --disableplugin=subscription-manager python2 -y
[Docker] #5 sha256:b0701849e64d62b83a057d7c8c77db49c8b332960b5806f4593e0bd69b27b805
[Docker] #5 CACHED
[Docker]
[Docker] #12 [ 8/10] WORKDIR /project
[Docker] #12 sha256:ec22ff479cc3492af38b1f51833c96bcca617670381dfa0cca71e3295af2fa3c
[Docker] #12 CACHED
[Docker]
[Docker] #13 [ 9/10] RUN mkdir -p /project/user-app/node_modules
[Docker] #13 sha256:ba5a0d1d9e90e2a1c3b11ffd2ae600242d74472e84c45c4c22d7b7bd643c1b19
[Docker] #13 CACHED
[Docker]
[Docker] #14 [10/10] RUN npm install
[Docker] #14 sha256:cfa034a4f0147619bf1400ffbb56827a2312da939f304d31b14277db0fd4deb4
[Docker] #14 ERROR: executor failed running [/bin/sh -c npm install]: exit code: 139
[Docker] ------
[Docker]  > [10/10] RUN npm install:
[Docker] ------
[Docker] executor failed running [/bin/sh -c npm install]: exit code: 139
[Error] exit status 1

My hunch is its because of permission issues. I am using mac m1

scottkurz commented 2 years ago

I don't know the answer (not too familiar with npm/Node myself) but let me just note the dev team is no longer developing appsody: https://appsody.dev/blogs/DevelopmentEnded