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. N8N
  3. Using handlebars.js

Using handlebars.js

Scheduled Pinned Locked Moved Solved N8N
17 Posts 6 Posters 3.3k Views 7 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.
  • girishG girish

    The package already has N8N_CUSTOM_EXTENSIONS="/app/data/custom" though I don't know if this means that a user can npm install handlebars in that directory and use it. Maybe @BrutalBirdie knows.

    BrutalBirdieB Offline
    BrutalBirdieB Offline
    BrutalBirdie
    Partner
    wrote on last edited by
    #4

    @girish Got no clue either šŸ˜„
    Will have to take a look at it.

    Like my work? Consider donating a drink. Cheers!

    girishG 1 Reply Last reply
    1
    • BrutalBirdieB BrutalBirdie

      @girish Got no clue either šŸ˜„
      Will have to take a look at it.

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #5

      @brutalbirdie looks like N8N_CUSTOM_EXTENSIONS is for custom nodes - https://docs.n8n.io/getting-started/installation/advanced/configuration.html#examples and not for custom node modules

      jeauJ 1 Reply Last reply
      1
      • girishG girish

        @brutalbirdie looks like N8N_CUSTOM_EXTENSIONS is for custom nodes - https://docs.n8n.io/getting-started/installation/advanced/configuration.html#examples and not for custom node modules

        jeauJ Offline
        jeauJ Offline
        jeau
        App Dev
        wrote on last edited by
        #6

        thanks to all, I am a newbe with n8n

        @girish @BrutalBirdie this doc indicate that for security reasons, importing modules is restricted by default in the Function-Nodes and that it is possible to lift that restriction by setting the following environment variables:

        • NODE_FUNCTION_ALLOW_BUILTIN: For builtin modules
        • NODE_FUNCTION_ALLOW_EXTERNAL: For external modules sourced from n8n/node_modules directory

        So I created a node_modules directory in /app/data/ and installed in it the module handlebars with the command npm install handlebars but it doesn't work. I also tried in /app/data/.n8n directory with the same result.

        girishG 1 Reply Last reply
        0
        • jeauJ jeau

          thanks to all, I am a newbe with n8n

          @girish @BrutalBirdie this doc indicate that for security reasons, importing modules is restricted by default in the Function-Nodes and that it is possible to lift that restriction by setting the following environment variables:

          • NODE_FUNCTION_ALLOW_BUILTIN: For builtin modules
          • NODE_FUNCTION_ALLOW_EXTERNAL: For external modules sourced from n8n/node_modules directory

          So I created a node_modules directory in /app/data/ and installed in it the module handlebars with the command npm install handlebars but it doesn't work. I also tried in /app/data/.n8n directory with the same result.

          girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #7

          @jeau I think the module has to be installed in the docker image itself. Is there a way to not use handlebars? Just curious why it's needed. Maybe we can add it to the n8n image itself.

          jeauJ 1 Reply Last reply
          0
          • girishG girish

            @jeau I think the module has to be installed in the docker image itself. Is there a way to not use handlebars? Just curious why it's needed. Maybe we can add it to the n8n image itself.

            jeauJ Offline
            jeauJ Offline
            jeau
            App Dev
            wrote on last edited by jeau
            #8

            @girish you can read this discussion https://community.n8n.io/t/text-templating-node/1965

            handelbars is a template system to facilitate the creation of html document pages, https://handlebarsjs.com/

            in my case, I want to get information from baserow tables and use n8n to generate reports and send them by mails

            girishG 1 Reply Last reply
            0
            • jeauJ jeau

              @girish you can read this discussion https://community.n8n.io/t/text-templating-node/1965

              handelbars is a template system to facilitate the creation of html document pages, https://handlebarsjs.com/

              in my case, I want to get information from baserow tables and use n8n to generate reports and send them by mails

              girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #9

              @jeau there is a env var NODE_PATH that tells node where to find additional node modules. So, you can set the variable in /app/data/env like NODE_PATH=/app/data/modules and then in Web Terminal:

              mkdir /app/data/modules
              cd /app/data/modules
              npm install handlebars
              

              Restart the app afterwards.

              jeauJ 1 Reply Last reply
              2
              • girishG girish

                @jeau there is a env var NODE_PATH that tells node where to find additional node modules. So, you can set the variable in /app/data/env like NODE_PATH=/app/data/modules and then in Web Terminal:

                mkdir /app/data/modules
                cd /app/data/modules
                npm install handlebars
                

                Restart the app afterwards.

                jeauJ Offline
                jeauJ Offline
                jeau
                App Dev
                wrote on last edited by
                #10

                @girish thanks, however I have this errors after passing the command npm install handlebars

                npm ERR! code EROFS
                npm ERR! syscall open
                npm ERR! path /root/.npm/_cacache/tmp/2122bb8f
                npm ERR! errno -30
                npm ERR! rofs EROFS: read-only file system, open '/root/.npm/_cacache/tmp/2122bb8f'
                npm ERR! rofs Often virtualized file systems, or other file systems
                npm ERR! rofs that don't support symlinks, give this error.
                

                I tried npm install --prefix /app/data/modules handlebars but the result was the same

                however, I have already successfully installed handelbars before, but I forgot how to do it šŸ˜ž

                robiR girishG 2 Replies Last reply
                0
                • jeauJ jeau

                  @girish thanks, however I have this errors after passing the command npm install handlebars

                  npm ERR! code EROFS
                  npm ERR! syscall open
                  npm ERR! path /root/.npm/_cacache/tmp/2122bb8f
                  npm ERR! errno -30
                  npm ERR! rofs EROFS: read-only file system, open '/root/.npm/_cacache/tmp/2122bb8f'
                  npm ERR! rofs Often virtualized file systems, or other file systems
                  npm ERR! rofs that don't support symlinks, give this error.
                  

                  I tried npm install --prefix /app/data/modules handlebars but the result was the same

                  however, I have already successfully installed handelbars before, but I forgot how to do it šŸ˜ž

                  robiR Offline
                  robiR Offline
                  robi
                  wrote on last edited by
                  #11
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • jeauJ jeau

                    @girish thanks, however I have this errors after passing the command npm install handlebars

                    npm ERR! code EROFS
                    npm ERR! syscall open
                    npm ERR! path /root/.npm/_cacache/tmp/2122bb8f
                    npm ERR! errno -30
                    npm ERR! rofs EROFS: read-only file system, open '/root/.npm/_cacache/tmp/2122bb8f'
                    npm ERR! rofs Often virtualized file systems, or other file systems
                    npm ERR! rofs that don't support symlinks, give this error.
                    

                    I tried npm install --prefix /app/data/modules handlebars but the result was the same

                    however, I have already successfully installed handelbars before, but I forgot how to do it šŸ˜ž

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #12

                    @jeau I can fix that . Can you try npm install handlebars --cache /tmp/foo in the meantime ?

                    jeauJ 1 Reply Last reply
                    0
                    • girishG girish

                      @jeau I can fix that . Can you try npm install handlebars --cache /tmp/foo in the meantime ?

                      jeauJ Offline
                      jeauJ Offline
                      jeau
                      App Dev
                      wrote on last edited by
                      #13

                      @girish I went back to a fresh installation, because I had not checked the changes of the recent updates. This fix allows me to install handelbars. But it still doesn't work, I still get the message Cannot find module 'handlebars' with this example.

                      My session:

                      root@XYZ:/app/data# vi env
                      root@XYZ:/app/data# cat env
                      # Set the logging level to 'debug'
                      export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
                      export EXECUTIONS_DATA_SAVE_ON_ERROR=all
                      export EXECUTIONS_DATA_SAVE_ON_SUCCESS=all
                      export N8N_LOG_LEVEL=info
                      export NODE_PATH=/app/data/modules
                      export NODE_FUNCTION_ALLOW_EXTERNAL=handlebars
                      root@XYZ:/app/data# mkdir modules
                      root@XYZ:/app/data# cd /app/data/modules
                      root@XYZ:/app/data/modules# npm install handlebars --cache /tmp/foo
                      npm WARN saveError ENOENT: no such file or directory, open '/app/data/modules/package.json'
                      npm notice created a lockfile as package-lock.json. You should commit this file.
                      npm WARN enoent ENOENT: no such file or directory, open '/app/data/modules/package.json'
                      npm WARN modules No description
                      npm WARN modules No repository field.
                      npm WARN modules No README data
                      npm WARN modules No license field.
                      
                      + handlebars@4.7.7
                      added 6 packages from 39 contributors and audited 6 packages in 0.834s
                      found 0 vulnerabilities
                      
                      ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                      │              npm update check failed              │
                      │        Try running with sudo or get access        │
                      │       to the local update config store via        │
                      │ sudo chown -R $USER:$(id -gn $USER) /root/.config │
                      ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                      root@XYZ:/app/data/modules# ls -al
                      total 16
                      drwxr-xr-x 3 root     root     4096 Oct  9 16:25 .
                      drwxr-xr-x 8 cloudron cloudron 4096 Oct  9 16:23 ..
                      drwxr-xr-x 9 root     root     4096 Oct  9 16:25 node_modules
                      -rw-r--r-- 1 root     root     1711 Oct  9 16:25 package-lock.json
                      root@XYZ:/app/data/modules# ls -al node_modules/
                      total 36
                      drwxr-xr-x 9 root root 4096 Oct  9 16:25 .
                      drwxr-xr-x 3 root root 4096 Oct  9 16:25 ..
                      drwxr-xr-x 2 root root 4096 Oct  9 16:25 .bin
                      drwxr-xr-x 6 root root 4096 Oct  9 16:25 handlebars
                      drwxr-xr-x 4 root root 4096 Oct  9 16:25 minimist
                      drwxr-xr-x 2 root root 4096 Oct  9 16:25 neo-async
                      drwxr-xr-x 4 root root 4096 Oct  9 16:25 source-map
                      drwxr-xr-x 5 root root 4096 Oct  9 16:25 uglify-js
                      drwxr-xr-x 4 root root 4096 Oct  9 16:25 wordwrap
                      root@XYZ:/app/data/modules#
                      
                      girishG 1 Reply Last reply
                      0
                      • jeauJ jeau

                        @girish I went back to a fresh installation, because I had not checked the changes of the recent updates. This fix allows me to install handelbars. But it still doesn't work, I still get the message Cannot find module 'handlebars' with this example.

                        My session:

                        root@XYZ:/app/data# vi env
                        root@XYZ:/app/data# cat env
                        # Set the logging level to 'debug'
                        export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
                        export EXECUTIONS_DATA_SAVE_ON_ERROR=all
                        export EXECUTIONS_DATA_SAVE_ON_SUCCESS=all
                        export N8N_LOG_LEVEL=info
                        export NODE_PATH=/app/data/modules
                        export NODE_FUNCTION_ALLOW_EXTERNAL=handlebars
                        root@XYZ:/app/data# mkdir modules
                        root@XYZ:/app/data# cd /app/data/modules
                        root@XYZ:/app/data/modules# npm install handlebars --cache /tmp/foo
                        npm WARN saveError ENOENT: no such file or directory, open '/app/data/modules/package.json'
                        npm notice created a lockfile as package-lock.json. You should commit this file.
                        npm WARN enoent ENOENT: no such file or directory, open '/app/data/modules/package.json'
                        npm WARN modules No description
                        npm WARN modules No repository field.
                        npm WARN modules No README data
                        npm WARN modules No license field.
                        
                        + handlebars@4.7.7
                        added 6 packages from 39 contributors and audited 6 packages in 0.834s
                        found 0 vulnerabilities
                        
                        ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                        │              npm update check failed              │
                        │        Try running with sudo or get access        │
                        │       to the local update config store via        │
                        │ sudo chown -R $USER:$(id -gn $USER) /root/.config │
                        ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                        root@XYZ:/app/data/modules# ls -al
                        total 16
                        drwxr-xr-x 3 root     root     4096 Oct  9 16:25 .
                        drwxr-xr-x 8 cloudron cloudron 4096 Oct  9 16:23 ..
                        drwxr-xr-x 9 root     root     4096 Oct  9 16:25 node_modules
                        -rw-r--r-- 1 root     root     1711 Oct  9 16:25 package-lock.json
                        root@XYZ:/app/data/modules# ls -al node_modules/
                        total 36
                        drwxr-xr-x 9 root root 4096 Oct  9 16:25 .
                        drwxr-xr-x 3 root root 4096 Oct  9 16:25 ..
                        drwxr-xr-x 2 root root 4096 Oct  9 16:25 .bin
                        drwxr-xr-x 6 root root 4096 Oct  9 16:25 handlebars
                        drwxr-xr-x 4 root root 4096 Oct  9 16:25 minimist
                        drwxr-xr-x 2 root root 4096 Oct  9 16:25 neo-async
                        drwxr-xr-x 4 root root 4096 Oct  9 16:25 source-map
                        drwxr-xr-x 5 root root 4096 Oct  9 16:25 uglify-js
                        drwxr-xr-x 4 root root 4096 Oct  9 16:25 wordwrap
                        root@XYZ:/app/data/modules#
                        
                        girishG Offline
                        girishG Offline
                        girish
                        Staff
                        wrote on last edited by
                        #14

                        @jeau I have fixed the package to support this. Please try https://docs.cloudron.io/apps/n8n/#custom-node-modules with the latest package 1.16.0

                        jeauJ rmdesR 2 Replies Last reply
                        1
                        • girishG girish

                          @jeau I have fixed the package to support this. Please try https://docs.cloudron.io/apps/n8n/#custom-node-modules with the latest package 1.16.0

                          jeauJ Offline
                          jeauJ Offline
                          jeau
                          App Dev
                          wrote on last edited by
                          #15

                          @girish great thank's, it works šŸ‘

                          S 1 Reply Last reply
                          1
                          • girishG girish

                            @jeau I have fixed the package to support this. Please try https://docs.cloudron.io/apps/n8n/#custom-node-modules with the latest package 1.16.0

                            rmdesR Offline
                            rmdesR Offline
                            rmdes
                            wrote on last edited by
                            #16

                            @girish Two questions:

                            Do I understand correctly that this is the only way to install external modules ?

                            Is there anything that need to be done (beside app restart) after adding the line in the env file?

                            girishG 1 Reply Last reply
                            0
                            • rmdesR rmdes

                              @girish Two questions:

                              Do I understand correctly that this is the only way to install external modules ?

                              Is there anything that need to be done (beside app restart) after adding the line in the env file?

                              girishG Offline
                              girishG Offline
                              girish
                              Staff
                              wrote on last edited by
                              #17

                              @rmdes right, if you want external modules, we have to fix the package. The modules are hardcoded in the Dockerfile.

                              1 Reply Last reply
                              1
                              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