Robert-W / grunt-ftp-push

Deploy files to an FTP server as part of your Grunt workflow.
MIT License
39 stars 14 forks source link

Warning: normalize #42

Open luisgagocasas opened 8 years ago

luisgagocasas commented 8 years ago

I have this problem because susede ?

Running "ftp_push:sample" (ftp_push) task Warning: Cannot call method 'normalize' of undefined Use --force to continue.

JasonEtco commented 8 years ago

I'm having this problem as well. Using this package in the same project as usual, so it must be some new update thats causing it.

Robert-W commented 8 years ago

Hmm, there was an update in september to change path.normalize to path.posix.normalize and all other calls to path to use path.posix. What system are you guys using?

I wonder if changing the calls from path.posix to path or path.win32 would resolve this issue.

Also, are you running the latest version(0.4.4)?

JasonEtco commented 8 years ago

I'm using Ubuntu, if that helps. JSFTP version is 1.5.3, and I am using 0.4.4 for this. I don't know JS well enough to change the calls you mentioned, but if you point me in the right direction I can figure it out.

Robert-W commented 8 years ago

Hey @JasonEtco. I can put up a sample file for you to try using or push a patch version to see if it fixes it for you, might be a day or two before I get the time to make the changes, test, and push a new build . In the meantime if you want to test something out and see if it fixes it for you, I am including instructions below.

  1. In grunt-ftp-push/tasks/ftp_push.js around line 157, change the following: basepath = path.posix.normalize(options.dest); to: basepath = path.normalize(options.dest);
  2. In grunt-ftp-push/tasks/utils.js do a search or find and look for all cases of path.posix and switch those for just path. So path.posix.join or path.posix.normalize would become path.join and path.normalize. There should only be 5 cases.

If you don't want to try it out, don't worry, Ill try to push another build out in the next day or two that will check for the existence of this before using it. Based on the error message provided Warning: Cannot call method 'normalize' of undefined, this is the only thing I can think of that would be causing it.

JasonEtco commented 8 years ago

@Robert-W thanks for getting back. I tried that out, and while I do not get the original error message, I now get: Fatal Error: connect ETIMEDOUT

Robert-W commented 8 years ago

Hmm, can you post your config that your using and any terminal output you are seeing? That sounds like it is having trouble connecting to your FTP server.

JasonEtco commented 8 years ago

@Robert-W Sure. Here is a screenshot of the full terminal output (fyi I'm using Jekyll and some other Grunt build tasks):

http://i.imgur.com/fbj7ugb.png

The relevant content of my Gruntfile.js:

ftp_push: {
          jasonetcovitch: {
            options: {
              authKey: "key1",
              host: "jasonetcovitch.com",
              dest: "/public_html/",
              port: 21
            },
            files: [
              {
                expand: true,
                cwd: '_site/',
                src: [ "**/*" ]
              }
            ]
          }
        },

If you need anything else, let me know! Thanks again for the help.

luisgagocasas commented 8 years ago

I found the solution to my problem . was that had nodejs and npm date. so now I have .

-v nodejs v5.4.1

NPM -v 3.5.3

Now if it works perfectly and grunt -ftp -push .

In advance thanks for the concern.

Robert-W commented 8 years ago

Thanks @luisgagocasas.

@JasonEtco Can you verify that you are able to connect to those folders on your server? Im not seeing any errors from the initial code, the first output should be something like this: <username> successfully authenticated or Could not authenticate with <username>

Robert-W commented 8 years ago

If the change fixed the path issue, I may close this ticket and reopen a new one for the timeout error as that seems like a different issue.

JasonEtco commented 8 years ago

@Robert-W

It seems that my original webhost, GoDaddy, changed their login system to require ftp. when connecting to the server. They didn't tell me that -.-

But now I have no problems, everything is perfect. Thanks so much for your help!

Robert-W commented 8 years ago

@JasonEtco.

Great, glad to hear.

Im gonna leave this open as a reminder to make those updates to path.posix for the next version, so keep using the one you edited for now, but there will be a new release marked as 1.0.0 coming this week sometime with those fixes.

Robert-W commented 8 years ago

Note to self: Use path.posix if it exists, otherwise use path in it's place.

JasonEtco commented 8 years ago

Actually I'm not sure you need to, updating Node also fixed the original issue for me. Might have just been some version issues

Robert-W commented 8 years ago

Ok, that's great. I will leave it as is then. Thanks for the update.

PatrikValkovic commented 8 years ago

I have got same problem. Debian GNU/Linux 8 (jessie) (Linux 3.16.0-4-amd64) npm 1.4.21 nodejs v0.10.29 After replaced file.posix with just file all worked for me.

Robert-W commented 8 years ago

@PatrikValkovic Thanks for reporting this, I will try to take a look this evening and see if I can figure out the issues and push out a patch so you don't have to make those changes anymore.