0

I am testing a small idea to have a node.js script on CloudFoundry to write a file in another FTP site.

var Ftp = require("jsftp");

var ftp = new Ftp({
    host: "ftp.somesite.com",
    user: "username",
    port: 21, 
    pass: "password"
});

var remotePath = "/test.txt";

var data = 'this is a test string';

ftp.getPutSocket(remotePath, function(err, socket) {
    socket.write(data, function(err) {
        console.log('good');
        socket.end();
    });
});

However when I do vmc push I got this error

Uploading my-ftp... FAILED
Upload failed. Try again with 'vmc push'.
Errno::ENOENT: No such file or directory - C:/Users/myUsername/AppData/Local/Temp/.
vmc_my-ftp_files/node_modules/jsftp/test/test_c9/??.md
For more information, see ~/.vmc/crash

The crash file doesn't tell me much either:

Errno::ENOENT: No such file or directory - C:/Users/myUsername/AppData/Local/Temp/.vmc_my-ftp_files/node_modules/jsftp/test/test_c9/??.md

cfoundry-0.4.14/lib/cfoundry/upload_helpers.rb:146:in `size'
cfoundry-0.4.14/lib/cfoundry/upload_helpers.rb:146:in `block in make_fingerprints'
cfoundry-0.4.14/lib/cfoundry/upload_helpers.rb:143:in `glob'
cfoundry-0.4.14/lib/cfoundry/upload_helpers.rb:143:in `make_fingerprints'
cfoundry-0.4.14/lib/cfoundry/upload_helpers.rb:125:in `determine_resources'
cfoundry-0.4.14/lib/cfoundry/upload_helpers.rb:44:in `upload'
vmc-0.4.7/lib/vmc/cli/app/push.rb:119:in `block in upload_app'
interact-0.5.0/lib/interact/progress.rb:98:in `with_progress'
vmc-0.4.7/lib/vmc/cli/app/push.rb:118:in `upload_app'
vmc-0.4.7/lib/vmc/cli/app/push.rb:100:in `setup_new_app'
vmc-0.4.7/lib/vmc/cli/app/push.rb:82:in `push'
mothership-0.3.5/lib/mothership/base.rb:61:in `run'
mothership-0.3.5/lib/mothership/command.rb:68:in `block in invoke'
manifests-vmc-plugin-0.4.19/lib/manifests-vmc-plugin/plugin.rb:113:in `call'
manifests-vmc-plugin-0.4.19/lib/manifests-vmc-plugin/plugin.rb:113:in `block (2 levels) in <class:Manifests>'
mothership-0.3.5/lib/mothership/callbacks.rb:74:in `with_filters'
manifests-vmc-plugin-0.4.19/lib/manifests-vmc-plugin/plugin.rb:112:in `block in <class:Manifests>'
mothership-0.3.5/lib/mothership/command.rb:78:in `instance_exec'
mothership-0.3.5/lib/mothership/command.rb:78:in `block (2 levels) in invoke'
mothership-0.3.5/lib/mothership/command.rb:82:in `instance_exec'
mothership-0.3.5/lib/mothership/command.rb:82:in `invoke'
mothership-0.3.5/lib/mothership/base.rb:50:in `execute'
vmc-0.4.7/lib/vmc/cli.rb:106:in `execute'
mothership-0.3.5/lib/mothership.rb:45:in `start'
vmc-0.4.7/bin/vmc:11:in `<top (required)>'
C:/Ruby193/bin/vmc:23:in `load'
C:/Ruby193/bin/vmc:23:in `<main>'

Any idea what I did wrong? It works fine on localhost.

HP.
  • 19,226
  • 53
  • 154
  • 253

2 Answers2

2

I have tried this and it seems to upload fine. With node apps, I am always careful to make sure what I have in my packages.json file matches the contents of node_modules. To be sure, remove node_modules completely and re-run 'npm install' before trying to push.

Also, as this doesn't appear to be an http-based application, remember to set the framework to standalone by selecting 'other' for frameworks and then selecting 'standalone'.

Dan Higham
  • 3,974
  • 16
  • 15
  • So I deleted the 'test' folder in node_modules/jsftp and it works now. Any idea on why is that? So there is an extra folder and it gave error? – HP. Dec 18 '12 at 19:40
  • 1
    Node will try and load _everything_ in the node_modules folder, regardless of what packages.json specifies. – Dan Higham Dec 18 '12 at 20:16
  • Which packages.json should I look at? There are many of them within node_modules. There isn't one in my main app folder though. – HP. Dec 18 '12 at 21:07
0

The right answer is to delete the 'test' folder in node_modules/jsftp

HP.
  • 19,226
  • 53
  • 154
  • 253