Installing Directus Extensions
-
Documented here - https://docs.cloudron.io/apps/directus/#custom-modules
@girish said in How to update/change a package.json in /app/code:
Documented here - https://docs.cloudron.io/apps/directus/#custom-modules
I'd like to propose a change in the documentation here:
Add
export EXTENSIONS_PATH="/app/data/node_modules"to the .env
then# cd /app/data # HOME=/app/data/ npm i directus-extension-herethen reboot directus
This seems to work fairly reliably. Only one extension I was not able to get to run this way.
-
@girish said in How to update/change a package.json in /app/code:
Documented here - https://docs.cloudron.io/apps/directus/#custom-modules
I'd like to propose a change in the documentation here:
Add
export EXTENSIONS_PATH="/app/data/node_modules"to the .env
then# cd /app/data # HOME=/app/data/ npm i directus-extension-herethen reboot directus
This seems to work fairly reliably. Only one extension I was not able to get to run this way.
@andreasdueren The app already sets
EXTENSIONS_PATH=/app/data/extensions. So, this is conflicting with your instructions. -
@andreasdueren The app already sets
EXTENSIONS_PATH=/app/data/extensions. So, this is conflicting with your instructions. -
@girish Hmm that's actually suboptimal I think. What is the reason not to put all environmental variables in the .env file for the user to modify?
@andreasdueren the
EXTENSIONS_PATHin your case is only working by accident. I am guessing the reason why one of the extensions doesn't work for you is because it has a scoped name ? Like@foo/directus-extension-bar? -
Investigating this on how to make it work properly .
There are two methods it seems - https://docs.directus.io/extensions/installing-extensions.html :
- via npm - this involves building a custom docker image. the code then just reads up package.json and looks for packages starting with
directus-extension-. - via Extensions Folder - the code is looking for subdirectories recursively named
directus-extension-and then reading the package.json inside that folder.
Ideally, we can use the Extensions folder to install packages via npm. However, npm is making this really difficult. Investigating...
- via npm - this involves building a custom docker image. the code then just reads up package.json and looks for packages starting with
-
@andreasdueren the
EXTENSIONS_PATHin your case is only working by accident. I am guessing the reason why one of the extensions doesn't work for you is because it has a scoped name ? Like@foo/directus-extension-bar?@girish said in Installing Directus Extensions:
@andreasdueren the EXTENSIONS_PATH in your case is only working by accident. I am guessing the reason why one of the extensions doesn't work for you is because it has a scoped name ? Like @foo/directus-extension-bar ?
I was wrong about this. The reason an extension is not working for you is maybe because it is not named
directus-extension-xxx? Does it have that prefix? -
@girish said in Installing Directus Extensions:
@andreasdueren the EXTENSIONS_PATH in your case is only working by accident. I am guessing the reason why one of the extensions doesn't work for you is because it has a scoped name ? Like @foo/directus-extension-bar ?
I was wrong about this. The reason an extension is not working for you is maybe because it is not named
directus-extension-xxx? Does it have that prefix?@girish said in Installing Directus Extensions:
@girish said in Installing Directus Extensions:
@andreasdueren the EXTENSIONS_PATH in your case is only working by accident. I am guessing the reason why one of the extensions doesn't work for you is because it has a scoped name ? Like @foo/directus-extension-bar ?
I was wrong about this. The reason an extension is not working for you is maybe because it is not named
directus-extension-xxx? Does it have that prefix?Nope that's not the problem. For example I have
directus-extension-api-docsvie npm in thenode_moduelsfolder installed but not working. Thepackage.jsonlists the following dependencies:"devDependencies": { "@directus/extensions-sdk": "^10.3.0", "@directus/shared": "^9.24.0", "@types/express": "^4.17.21", "@types/jest": "^29.5.11", "@types/node": "^18.19.8", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "eslint": "^8.56.0", "eslint-config-prettier": "^8.10.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^4.2.1", "express": "^4.18.2", "jest": "^29.7.0", "jest-extended": "^3.2.4", "openapi-schema-validator": "^12.1.3", "pino": "^8.17.2", "prettier": "^2.8.8", "ts-jest": "^29.1.1", "ts-node": "^10.9.2", "typescript": "^4.9.5" }These are the ones that did not install for some reason:
"@directus/extensions-sdk": "^10.3.0", "@directus/shared": "^9.24.0", "eslint-config-prettier": "^8.10.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.7.0", "jest-extended": "^3.2.4", "openapi-schema-validator": "^12.1.3", "pino": "^8.17.2", "prettier": "^2.8.8", "ts-jest": "^29.1.1", "ts-node": "^10.9.2", -
@andreasdueren The app already sets
EXTENSIONS_PATH=/app/data/extensions. So, this is conflicting with your instructions.@girish said in Installing Directus Extensions:
@andreasdueren The app already sets
EXTENSIONS_PATH=/app/data/extensions. So, this is conflicting with your instructions.Going through the repository I also noticed that I am trying to change various other environmental variables:
export STORAGE_LOCATIONS="local,s3" export AUTH_OKTA_DRIVER="openid" # as a side-note: It would be nice to have openID set up directly without having to do it manually export AUTH_DISABLE_DEFAULT="true"They also seem to work (even though I do have some glitches sometimes with the storage locations)
-
@girish said in Installing Directus Extensions:
@girish said in Installing Directus Extensions:
@andreasdueren the EXTENSIONS_PATH in your case is only working by accident. I am guessing the reason why one of the extensions doesn't work for you is because it has a scoped name ? Like @foo/directus-extension-bar ?
I was wrong about this. The reason an extension is not working for you is maybe because it is not named
directus-extension-xxx? Does it have that prefix?Nope that's not the problem. For example I have
directus-extension-api-docsvie npm in thenode_moduelsfolder installed but not working. Thepackage.jsonlists the following dependencies:"devDependencies": { "@directus/extensions-sdk": "^10.3.0", "@directus/shared": "^9.24.0", "@types/express": "^4.17.21", "@types/jest": "^29.5.11", "@types/node": "^18.19.8", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "eslint": "^8.56.0", "eslint-config-prettier": "^8.10.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^4.2.1", "express": "^4.18.2", "jest": "^29.7.0", "jest-extended": "^3.2.4", "openapi-schema-validator": "^12.1.3", "pino": "^8.17.2", "prettier": "^2.8.8", "ts-jest": "^29.1.1", "ts-node": "^10.9.2", "typescript": "^4.9.5" }These are the ones that did not install for some reason:
"@directus/extensions-sdk": "^10.3.0", "@directus/shared": "^9.24.0", "eslint-config-prettier": "^8.10.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.7.0", "jest-extended": "^3.2.4", "openapi-schema-validator": "^12.1.3", "pino": "^8.17.2", "prettier": "^2.8.8", "ts-jest": "^29.1.1", "ts-node": "^10.9.2",@andreasdueren did you see a "Killed" message when you ran npm install? I saw this when I was testing one other extension. The installed was killed mid way possibly due to lack of memory, I didn't investigate.
-
@andreasdueren did you see a "Killed" message when you ran npm install? I saw this when I was testing one other extension. The installed was killed mid way possibly due to lack of memory, I didn't investigate.
@girish said in Installing Directus Extensions:
@andreasdueren did you see a "Killed" message when you ran npm install? I saw this when I was testing one other extension. The installed was killed mid way possibly due to lack of memory, I didn't investigate.
I don't remember seeing one, no. I will try to replicate that.
-
I have added a script now in the latest package to install extensions. Seems to work with the extensions I have tried . See https://docs.cloudron.io/apps/directus/#extensions . I tested
directus-extension-api-docsas well. -
I have added a script now in the latest package to install extensions. Seems to work with the extensions I have tried . See https://docs.cloudron.io/apps/directus/#extensions . I tested
directus-extension-api-docsas well.@girish said in Installing Directus Extensions:
I have added a script now in the latest package to install extensions. Seems to work with the extensions I have tried . See https://docs.cloudron.io/apps/directus/#extensions . I tested
directus-extension-api-docsas well.Awesome thank you!
-
Seems to work like a charm!
-
N nebulon marked this topic as a question on
-
N nebulon has marked this topic as solved on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login