Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Directus
  3. How to update/change a package.json in /app/code

How to update/change a package.json in /app/code

Scheduled Pinned Locked Moved Solved Directus
9 Posts 3 Posters 1.5k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    devtron
    wrote on last edited by
    #1

    Since I need to add some custom files in app/data, I need to include some other packages in my node app (package.json) that only lives in /app/code. But it is always overwritten after a restart so my question is how to persist the new packages in my package.json? What tricks are possible?

    1 Reply Last reply
    0
    • girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #2

      @devtron Is this a custom app? Or some app from the App Store ?

      D 1 Reply Last reply
      0
      • girishG girish

        @devtron Is this a custom app? Or some app from the App Store ?

        D Offline
        D Offline
        devtron
        wrote on last edited by
        #3

        @girish
        From the AppStore

        1 Reply Last reply
        0
        • nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #4

          Which app is this then? Custom node_modules have to be supported by the app or the package

          D 1 Reply Last reply
          0
          • nebulonN nebulon marked this topic as a question on
          • nebulonN nebulon

            Which app is this then? Custom node_modules have to be supported by the app or the package

            D Offline
            D Offline
            devtron
            wrote on last edited by
            #5

            @nebulon Directus

            1 Reply Last reply
            0
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #6

              I guess this is related to https://forum.cloudron.io/topic/9129/how-to-install-npm-packages-in-your-app/3 .

              mm, so far , we haven't found a good way to do this. You want to install custom node modules for your extension, correct ?

              1 Reply Last reply
              0
              • girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by girish
                #7

                @devtron I don't know much about Directus extensions. But it looks like say https://github.com/dimitrov-adrian/directus-extension-searchsync is an extension ? Each extension has a package.json of it's own.

                (If the above is correct...)

                • You can then npm install in the extension's subdirectory
                • Then, in /app/data/env.sh just add export NODE_PATH=/app/data/extensions/myext/node_modules and restart the app.

                Would something like above work? NODE_PATH sets the search directory for node modules. You can even set multiple paths separated by colon.

                1 Reply Last reply
                1
                • D Offline
                  D Offline
                  devtron
                  wrote on last edited by
                  #8

                  I was able to run the scripts. I just needed to init them with npm init and add the packages in the package.json. Each of them has their own node_modules now. Thanks for your help 👍

                  1 Reply Last reply
                  2
                  • D devtron has marked this topic as solved on
                  • girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #9

                    Documented here - https://docs.cloudron.io/apps/directus/#custom-modules

                    andreasduerenA 1 Reply Last reply
                    1
                    • girishG girish forked this topic on
                    • girishG girish locked this topic on
                    • girishG girish moved this topic from Support on
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Bookmarks
                    • Search