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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Using the n8n CLI

    N8N
    4
    10
    431
    Loading More Posts
    • 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.
    • S
      sparkwise last edited by

      n8n ships with a n8n CLI (found on Cloudron at /app/code/node_modules/.bin/n8n.) When I try to use it to export a workflow, I run into this...

      /app/code/node_modules/.bin/n8n export:workflow --backup --output=/tmp/n8n/
      

      Error exporting workflows. See log messages for details.
      EROFS: read-only file system, mkdir '/root/.n8n'

      Is there a different way to invoke the command that works on Cloudron?

      JOduMonT 1 Reply Last reply Reply Quote 2
      • robi
        robi last edited by

        looks at the command options and see if there's a way to specify the configuration directory, since it seems it is failing trying to create one.

        Life of Advanced Technology

        JOduMonT 1 Reply Last reply Reply Quote 0
        • JOduMonT
          JOduMonT @sparkwise last edited by JOduMonT

          @sparkwise said in Using the n8n CLI:

          Is there a different way to invoke the command that works on Cloudron?

          I exactly encounter the same error on the same command

          Personally I thought to run the command with as user cloudron (1000)
          but then I have another issue πŸ˜‰

          su -c '/app/code/node_modules/n8n/bin/n8n export:workflow --backup --output=/app/data/user/backups/' cloudron
          

          /usr/bin/env: β€˜node’: No such file or directory

          PS: I also tried your variation but end with the same issue

          su -c '/app/code/node_modules/.bin/n8n export:workflow --backup --output=/app/data/user/backups/' cloudron
          

          UPDATE

          This work'ish

          su -c '/usr/local/node-16.15.0/bin/node /app/code/node_modules/n8n/bin/n8n export:workflow --backup --output=/app/data/user/backups/' cloudron
          

          but it came with the almost with the same error then you

          Error exporting workflows. See log messages for details.
          EROFS: read-only file system, mkdir '/home/cloudron/.n8n'

          also it is not really sustainable since the node version is hard-coded in my command.

          1 Reply Last reply Reply Quote 0
          • JOduMonT
            JOduMonT @robi last edited by JOduMonT

            @robi said in Using the n8n CLI:

            looks at the command options and see if there's a way to specify the configuration directory, since it seems it is failing trying to create one.

            sadly, the command is not very voluble on that information

            /app/code/node_modules/.bin/n8n --help                                                             
            n8n Workflow Automation Tool
            
            VERSION
              n8n/0.179.0 linux-x64 node-v16.15.0
            
            USAGE
              $ n8n [COMMAND]
            
            TOPICS
              db               Revert last database migration
              export           Export credentials
              import           Import credentials
              list
              update           Update workflows
              user-management
            
            COMMANDS
              execute
              executeBatch
              start         Starts n8n. Makes Web-UI available and starts active workflows
              webhook       Starts n8n webhook process. Intercepts only production URLs.
              worker
            
            • I asked them n8n community
            robi 1 Reply Last reply Reply Quote 0
            • robi
              robi @JOduMonT last edited by robi

              This may be the way, setting it via an environment variable since it doesn't appear to have a CLI parameter:
              https://docs.n8n.io/hosting/configuration/

              Life of Advanced Technology

              1 Reply Last reply Reply Quote 1
              • girish
                girish Staff last edited by

                @JOduMonT @sparkwise the n8n user directory has to be set.

                # export N8N_USER_FOLDER="/app/data/user"
                # export N8N_CONFIG_FILES="/app/data/configs/default.json"
                # gosu cloudron /app/code/node_modules/.bin/n8n export:workflow --backup --output=/tmp/n8n/
                
                Loading configuration overwrites from:
                 - /app/data/configs/default.json
                
                Error exporting workflows. See log messages for details.
                No workflows found with specified filters.
                

                I will move the env vars into the Dockerfile, so this will work out of the box.

                1 Reply Last reply Reply Quote 3
                • girish
                  girish Staff last edited by

                  Please try in the latest package. I put this in the docs as well - https://docs.cloudron.io/apps/n8n/#cli

                  S JOduMonT 3 Replies Last reply Reply Quote 1
                  • S
                    sparkwise @girish last edited by

                    @girish That worked perfectly! Thank you.

                    1 Reply Last reply Reply Quote 0
                    • S
                      sparkwise @girish last edited by

                      @girish said in Using the n8n CLI:

                      I put this in the docs as well - https://docs.cloudron.io/apps/n8n/#cli

                      In the docs, it could be helpful to linking "n8n CLI" to the documentation link: https://docs.n8n.io/reference/cli-commands/

                      1 Reply Last reply Reply Quote 3
                      • Topic has been marked as a question  nebulon nebulon 
                      • Topic has been marked as solved  nebulon nebulon 
                      • JOduMonT
                        JOduMonT @girish last edited by

                        @girish + @nebulon it is very nice to have access to you; you are very responsive and highly competent πŸ˜‰
                        thank you!

                        1 Reply Last reply Reply Quote 4
                        • First post
                          Last post
                        Powered by NodeBB