title: How can I remotely deploy a flow file in Node-RED?
body: <p>Is there any way for deploying an existing Node-RED flow file <code>myflow.json</code> to a remote machine running Node-RED?</p>
  
  <p>After much googling, I stumbled upon <a href="https://groups.google.com/forum/#!topic/node-red/5ODQQfExcCg" rel="nofollow noreferrer">this discussion</a> in the relevant Google group, but it is not very enlightening.</p>
  
  <p><strong>UPDATE</strong> (after the suggested answer below)</p>
  
  <p>Here is the output of the suggested request from a remote machine:</p>
  
  <pre><code>[scripts]$ curl -v -X POST http://192.168.70.73:1880/flows -H "Content-Type: application/json"  --data "@remote_test.json" 
  * About to connect() to 192.168.70.73 port 1880 (#0)
  *   Trying 192.168.70.73... connected
  * Connected to 192.168.70.73 (192.168.70.73) port 1880 (#0)
  &gt; POST /flows HTTP/1.1
  &gt; User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
  &gt; Host: 192.168.70.73:1880
  &gt; Accept: */*
  &gt; Content-Type: application/json
  &gt; Content-Length: 1088
  &gt; Expect: 100-continue
  &gt; 
  &lt; HTTP/1.1 100 Continue
  &lt; HTTP/1.1 204 No Content
  &lt; X-Powered-By: Express
  &lt; Date: Fri, 10 Feb 2017 11:45:24 GMT
  &lt; Connection: keep-alive
  &lt; 
  * Connection #0 to host 192.168.70.73 left intact
  * Closing connection #0
  </code></pre>
  
  <p>with a 204 response (indicating <a href="http://nodered.org/docs/api/admin/methods/post/flows/" rel="nofollow noreferrer">success</a>).</p>
  
  <p>Here is the respective output in the local machine console:</p>
  
  <pre><code>10 Feb 13:45:24 - [info] Stopping flows
  10 Feb 13:45:24 - [info] Stopped flows
  10 Feb 13:45:24 - [info] Starting flows
  10 Feb 13:45:24 - [info] Started flows
  </code></pre>
  
  <p>after which nothing happens.</p>
  
  <p>The flow-to-be-deployed <code>remote_test.json</code> does indeed show up in the GUI of the local machine, but it is not running; furthermore, when I try to manually inject or enable the debug node, I get an <code>Error: node not deployed</code> in the local GUI (and the 'Deploy' button is inactive).</p>
  
  <p>This is the ultra-simple flow:</p>
  
  <p><a href="http://nodered.org/docs/api/admin/methods/post/flows/" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bEaZX.png" alt="remote_test.json"></a></p>
  
  <p>with the <code>format</code> node simply parsing the temperature measurements received from <code>get_temp</code> every 5 seconds and adding a timestamp:</p>
  
  <pre class="lang-js prettyprint-override"><code>var temp = parseFloat(msg.payload.replace( /[^\d\.]*/g, ''));
  var time = new Date().toISOString().replace(/\..+/, '');
  
  msg.payload = {'measurements' : [ { 'time'        : time }, 
                                    { 'temperature' : temp } ]
  };
  console.log(msg.payload);
  return msg;
  </code></pre>
  
  <p>And here is the console output when the flow is deployed locally:</p>
  
  <pre><code>10 Feb 14:08:25 - [info] Stopped flows
  10 Feb 14:08:25 - [info] Starting flows
  10 Feb 14:08:25 - [info] Started flows
  { measurements: [ { time: '2017-02-10T12:08:30' }, { temperature: 34.7 } ] }
  { measurements: [ { time: '2017-02-10T12:08:35' }, { temperature: 34.2 } ] }
  { measurements: [ { time: '2017-02-10T12:08:40' }, { temperature: 33.6 } ] }
  { measurements: [ { time: '2017-02-10T12:08:45' }, { temperature: 33.6 } ] }
  </code></pre>
  
  <p>Starting the service with <code>node-red-start</code> or <code>node-red</code>, as well as including or not the argument <code>-H "Node-RED-Deployment-Type: full"</code> in the request, do not make any difference.</p>
  
  <p>System configuration:</p>
  
  <ul>
  <li>Raspberry Pi 3</li>
  <li>Node.js 7.4.0</li>
  <li>Node-RED 0.13.4</li>
  </ul>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>It seems that the issue was with the Node.js and/or Node-RED versions. Tried it in a different Pi, running Node.js 6.9.5 &amp; Node-RED 0.16.2, and it works OK.</p>