Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically install Strapi plugins #74

Open
acka47 opened this issue Dec 18, 2024 · 1 comment
Open

Automatically install Strapi plugins #74

acka47 opened this issue Dec 18, 2024 · 1 comment

Comments

@acka47
Copy link
Contributor

acka47 commented Dec 18, 2024

Yesterday, on my laptop at home, when setting up the docker container from a fresh clone, I got the following error message in the browser after having set up and started the Docker container:

ERROR in ./src/plugins/lookup/admin/src/components/Autocomplete/autocomplete.js 4:0-56
Module not found: Error: Can't resolve '@algolia/autocomplete-js' in '/opt/app/src/plugins/lookup/admin/src/components/Autocomplete'
ERROR in ./src/plugins/lookup/admin/src/components/Autocomplete/index.js 13:0-45
Module not found: Error: Can't resolve '@algolia/autocomplete-theme-classic' in '/opt/app/src/plugins/lookup/admin/src/components/Autocomplete'

I then needed to do the following steps to make it work:

  1. Go into the container with docker exec -it strapi-rpb bash
  2. cd src/plugins/lookup
  3. npm i

We should make sure that these work out of the box.

@Phu2
Copy link
Contributor

Phu2 commented Dec 18, 2024

I can reproduce this behavior only occasionally so my guess is that the RUN npm install command in Dockerfile.dev and Dockerfile.prod sometimes fails (for whatever reason). If this is the case the solution is try again.

However, it is important to be sure that you are building the image anew without any cache from Docker:

First build the image from scratch:
docker compose build --no-cache

Then start container from newly created image:
docker compose up

Attention: Executing docker compose up --build is not sufficient as Docker will build a new image but using build cache as you can see in the output of above command:

 => CACHED [strapi-rpb  2/12] RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev                                                             0.0s
 => CACHED [strapi-rpb  3/12] RUN chown -R node:node /opt/                                                                                                                                             0.0s
 => CACHED [strapi-rpb  4/12] WORKDIR /opt/                                                                                                                                                            0.0s
 => CACHED [strapi-rpb  5/12] COPY --chown=node:node ./package.json ./package-lock.json ./                                                                                                             0.0s
 => CACHED [strapi-rpb  6/12] RUN npm install                                                                                                                                                          0.0s
 => CACHED [strapi-rpb  7/12] WORKDIR /opt/app/src/plugins/lookup                                                                                                                                      0.0s
 => CACHED [strapi-rpb  8/12] COPY --chown=node:node src/plugins/lookup/package.json src/plugins/lookup/package-lock.json ./                                                                           0.0s
 => CACHED [strapi-rpb  9/12] RUN npm install                                                                                                                                                          0.0s
 => CACHED [strapi-rpb 10/12] WORKDIR /opt/app     

cc @fsteeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants