directus icon indicating copy to clipboard operation
directus copied to clipboard

Extension installation - PNPM upgrade breaks installation from Dockerfile

Open zguig52 opened this issue 1 year ago • 6 comments

Describe the Bug

After upgrading to latest directus, I couldn't deploy it with extensions.

I had to change the Dockerfile to make it work (cf reproduction). If this is expected and the right way to do it, maybe you could update the documentation.


 => 
------                                                                                                                                                                                                            
 > [admin-dev 3/3] RUN pnpm install directus-extension-models directus-extension-api-viewer directus-extension-schema-sync:                                                                                       
0.941 ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-9.10.0.tgz                                                                                                                           
2.019  ERR_PNPM_UNEXPECTED_STORE  Unexpected store location                                                                                                                                                       
2.019                                                                                                                                                                                                             
2.019 The dependencies at "/directus/node_modules" are currently linked from the store at "/root/.local/share/pnpm/store/v3".                                                                                     
2.019                                                                                                                                                                                                             
2.019 pnpm now wants to use the store at "/home/node/.local/share/pnpm/store/v3" to link dependencies.                                                                                                            
2.019                                                                                                                                                                                                             
2.019 If you want to use the new store location, reinstall your dependencies with "pnpm install".                                                                                                                 
2.019 
2.019 You may change the global store location by running "pnpm config set store-dir <dir> --global".
2.019 (This error may happen if the node_modules was installed with a different major version of pnpm)
------
failed to solve: process "/bin/sh -c pnpm install directus-extension-models directus-extension-api-viewer directus-extension-schema-sync" did not complete successfully: exit code: 1

To Reproduce

My Dockerfile was following documentation:

FROM docker.io/directus/directus:{{ deploy.api[deploy.env.name].directus_release }}
USER root
RUN corepack enable
USER node
RUN pnpm install directus-extension-models directus-extension-api-viewer directus-extension-schema-sync

I manage to make it work by installing extensions as root:

FROM docker.io/directus/directus:{{ deploy.api[deploy.env.name].directus_release }}
USER root
RUN corepack enable
RUN pnpm install directus-extension-models directus-extension-api-viewer directus-extension-schema-sync
USER node

Directus Version

v11.1.1

Hosting Strategy

Self-Hosted (Docker Image)

Database

No response

zguig52 avatar Oct 09 '24 08:10 zguig52