1

I'm trying to build a MedusaJS Docker image.

It seems to work so far, only when installing the NPM RUN npm install --loglevel=error from the dockerfile there seems to be a problem. I have absolutely no idea about NPM and currently have no idea what to look for. The dockerfiles are unchanged from the repo.

Error output:

 => [backend:test internal] load build definition from Dockerfile                                                                                                                                   0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                 0.0s
 => [admin:test internal] load build definition from Dockerfile                                                                                                                                     0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                 0.0s
 => [storefront:test internal] load build definition from Dockerfile                                                                                                                                0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                 0.0s
 => [backend:test internal] load .dockerignore                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                     0.0s
 => [storefront:test internal] load .dockerignore                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                     0.0s
 => [admin:test internal] load .dockerignore                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                     0.0s
 => [backend:test internal] load metadata for docker.io/library/node:17.1.0                                                                                                                         1.0s
 => [admin:test internal] load metadata for docker.io/library/node:latest                                                                                                                           1.0s
 => [backend:test internal] load build context                                                                                                                                                      0.0s
 => => transferring context: 128B                                                                                                                                                                   0.0s
 => [backend:test 1/9] FROM docker.io/library/node:17.1.0@sha256:22f1866405ad50bb1d141739596ba803aed073d618ab2ae6d5e66aedcf9261b5                                                                   0.0s
 => [storefront:test  1/10] FROM docker.io/library/node:latest@sha256:a0a2fc4435b0c9ae7bec0a69b1279323a4a41c5a005581fbf30d39cd5777db37                                                              0.0s
 => [admin:test internal] load build context                                                                                                                                                        0.0s
 => => transferring context: 67B                                                                                                                                                                    0.0s
 => [storefront:test internal] load build context                                                                                                                                                   0.0s
 => => transferring context: 67B                                                                                                                                                                    0.0s
 => CACHED [backend:test 2/9] WORKDIR /app/medusa                                                                                                                                                   0.0s
 => CACHED [backend:test 3/9] COPY package.json .                                                                                                                                                   0.0s
 => CACHED [backend:test 4/9] RUN apt-get update                                                                                                                                                    0.0s
 => CACHED [backend:test 5/9] RUN apt-get install -y python                                                                                                                                         0.0s
 => CACHED [backend:test 6/9] RUN npm install -g npm@latest                                                                                                                                         0.0s
 => CACHED [backend:test 7/9] RUN npm install -g @medusajs/medusa-cli@latest                                                                                                                        0.0s
 => ERROR [backend:test 8/9] RUN npm install --loglevel=error                                                                                                                                      13.0s
 => CACHED [storefront:test 2/9] WORKDIR /app/storefront                                                                                                                                            0.0s
 => CACHED [storefront:test 3/9] COPY . .                                                                                                                                                           0.0s
 => CACHED [storefront:test 4/9] RUN rm -rf node_modules                                                                                                                                            0.0s
 => CACHED [storefront:test 5/9] RUN apt-get update                                                                                                                                                 0.0s
 => CACHED [storefront:test 6/9] RUN npm install -g npm@latest                                                                                                                                      0.0s
 => CACHED [admin:test  2/10] WORKDIR /app/admin                                                                                                                                                    0.0s
 => CACHED [admin:test  3/10] COPY . .                                                                                                                                                              0.0s
 => CACHED [admin:test  4/10] RUN rm -rf node_modules                                                                                                                                               0.0s
 => CACHED [admin:test  5/10] RUN apt-get update                                                                                                                                                    0.0s
 => CACHED [admin:test  6/10] RUN npm install -g npm@latest                                                                                                                                         0.0s
 => CACHED [admin:test  7/10] RUN npm install sharp                                                                                                                                                 0.0s
 => CANCELED [admin:test  8/10] RUN npm install -g gatsby-cli                                                                                                                                      13.1s
 => CANCELED [storefront:test 7/9] RUN npm install -g gatsby-cli                                                                                                                                   13.2s
------
 > [backend:test 8/9] RUN npm install --loglevel=error:
#0 12.93 npm ERR! code EUNSUPPORTEDPROTOCOL
#0 12.93 npm ERR! Unsupported URL Type "link:": link:docs-util/typedoc-plugins/typedoc-frontmatter-plugin
#0 12.93
#0 12.93 npm ERR! A complete log of this run can be found in:
#0 12.93 npm ERR!     /root/.npm/_logs/2022-08-28T12_36_45_074Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm install --loglevel=error]: exit code: 1

Krulle
  • 11
  • 1

1 Answers1

1

A bit late, but writing in case anyone else encounters the same issue

Like myself, you've probably copied the package.json file into the /backend folder, as described in this comment, but event if you didn't this solution still applies.

The dependency that's causing the issue is typedoc-frontmatter-plugin as can be seen in the output you posted

To fix this, change line 45 of backend/package.json (or whichever line defines typedoc-frontmatter-plugin as a dependecy) from

"typedoc-frontmatter-plugin": "link:docs-util/typedoc-plugins/typedoc-frontmatter-plugin"

to

"typedoc-frontmatter-plugin": "file:./docs-util/typedoc-plugins/typedoc-frontmatter-plugin"

More details regarding this issue here

A few additional notes regarding running Medusa from Docker:

  • I had to add --force at the end of RUN npm install --loglevel=error in backend/Dockerfile to get all dependencies to install
  • Make sure both develop.sh scripts (in root and backend folder) are executable, otherwise Docker won't be able to start the services
fvfvfvfv
  • 61
  • 1
  • 3