Remote-ftp: Uncaught TypeError: Path must be a string. Received null

Created on 4 May 2016  路  16Comments  路  Source: icetee/remote-ftp

When trying to use watch functionality I get the following.

Atom Version: 1.7.3
System: Mac OS X 10.11.4
Thrown From: Remote-FTP package, v0.8.3

Stack Trace

Uncaught TypeError: Path must be a string. Received null

At path.js:8

TypeError: Path must be a string. Received null
    at assertPath (path.js:8:11)
    at Object.posix.resolve (path.js:426:5)
    at /Users/jimmy/.atom/packages/Remote-FTP/lib/client.js:746:25
    at Array.forEach (native)
    at Client.module.exports.Client.watch.addListeners (/Users/jimmy/.atom/packages/Remote-FTP/lib/client.js:745:14)
    at emitNone (events.js:72:20)
    at Client.emit (events.js:166:7)
    at ConnectorSFTP.<anonymous> (/Users/jimmy/.atom/packages/Remote-FTP/lib/client.js:283:9)
    at /Users/jimmy/.atom/packages/Remote-FTP/lib/connectors/sftp.js:56:16
    at SFTPStream.onReady (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/lib/client.js:758:9)
    at SFTPStream.g (events.js:260:16)
    at emitNone (events.js:67:13)
    at SFTPStream.emit (events.js:166:7)
    at SFTPStream._transform (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:340:14)
    at SFTPStream.Transform._read (_stream_transform.js:167:10)
    at SFTPStream._read (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:170:15)
    at SFTPStream.Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:292:12)
    at writeOrBuffer (_stream_writable.js:278:5)
    at SFTPStream.Writable.write (_stream_writable.js:207:11)
    at Channel.ondata (_stream_readable.js:528:20)
    at emitOne (events.js:77:13)
    at Channel.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Channel.Readable.push (_stream_readable.js:110:10)
    at SSH2Stream.<anonymous> (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/lib/Channel.js:146:15)
    at emitOne (events.js:77:13)
    at SSH2Stream.emit (events.js:169:7)
    at parsePacket (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:3163:10)
    at SSH2Stream._transform (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:551:13)
    at SSH2Stream.Transform._read (_stream_transform.js:167:10)
    at SSH2Stream._read (/Users/jimmy/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:212:15)
    at SSH2Stream.Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:292:12)
    at writeOrBuffer (_stream_writable.js:278:5)
    at SSH2Stream.Writable.write (_stream_writable.js:207:11)
    at Socket.ondata (_stream_readable.js:528:20)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:523:20)

Most helpful comment

I've created a Pull Request fixing this issue.

All 16 comments

I've created a Pull Request fixing this issue.

I changed client.js file just like you changed it in your pull request and the error is still present.

I fixed this problem by removing placeholder from "watch" property in .ftpconfig file object.

I am receiving the same error. It shouldn't be requiring a string there, the configuration options mentions that it should be an array of different files. Configuration array shown below:

screen shot 2016-05-12 at 12 15 37 pm

Also, on a somewhat related note, is it possible to have it watch an entire directory for changes? For example:

"watch": [ "/dist/css/**/*.css", "/dist/js/**/*.js" ]

That would be awesome, but I don't see any mention of it in the documentation.

Thanks! & Awesome package!

@jimmaaay That fix worked for me! I no longer get an error when I have an array of files!

and +1 to @derekcavaliero's request for the acceptance of globs in the watch array! Or even just an entire directory...

I'm still getting this error, in my .ftpconfig file i have it like this:

"watch": ["./styles/css/style.css"]

Using Gulp to compile en minify (also watch). Is there a solution yet?

@wouter1407 What version of remote ftp are you using?

@jimmaaay I'm using 0.8.3, checked for updates but Atom says there are none.

@wouter1407 could you try uninstalling and reinstalling remote ftp, then if you still get the error can you paste it into the thread.

@jimmaaay
I'm getting this error too now. I tried uninstalling remote-ftp & reinstalling it and still get the error.

This is what I have for the watch line:
"watch": ["./style.css"]

When I try the following (removing the leading '.') it connects but it says "Could not find /style.css to watch" even though that file is in my project's root folder.
"watch": ["/style.css"]

When I try the following, it gives me the "Path must be a string..." error again.
"watch": ["style.css"]

Here is the error report:

Atom Version: 1.8.0
System: Mac OS X 10.11.1
Thrown From: Remote-FTP package, v0.8.3

Stack Trace

Uncaught TypeError: Path must be a string. Received null

At path.js:8

TypeError: Path must be a string. Received null
    at assertPath (path.js:8:11)
    at Object.posix.resolve (path.js:426:5)
    at /Users/ron/.atom/packages/Remote-FTP/lib/client.js:746:25
    at Array.forEach (native)
    at Client.module.exports.Client.watch.addListeners (/Users/ron/.atom/packages/Remote-FTP/lib/client.js:745:14)
    at emitNone (events.js:72:20)
    at Client.emit (events.js:166:7)
    at ConnectorSFTP.<anonymous> (/Users/ron/.atom/packages/Remote-FTP/lib/client.js:283:9)
    at /Users/ron/.atom/packages/Remote-FTP/lib/connectors/sftp.js:56:16
    at SFTPStream.onReady (/Users/ron/.atom/packages/Remote-FTP/node_modules/ssh2/lib/client.js:758:9)
    at SFTPStream.g (events.js:260:16)
    at emitNone (events.js:67:13)
    at SFTPStream.emit (events.js:166:7)
    at SFTPStream._transform (/Users/ron/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:340:14)
    at SFTPStream.Transform._read (_stream_transform.js:167:10)
    at SFTPStream._read (/Users/ron/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:170:15)
    at SFTPStream.Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:292:12)
    at writeOrBuffer (_stream_writable.js:278:5)
    at SFTPStream.Writable.write (_stream_writable.js:207:11)
    at Channel.ondata (_stream_readable.js:528:20)
    at emitOne (events.js:77:13)
    at Channel.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Channel.Readable.push (_stream_readable.js:110:10)
    at SSH2Stream.<anonymous> (/Users/ron/.atom/packages/Remote-FTP/node_modules/ssh2/lib/Channel.js:146:15)
    at emitOne (events.js:77:13)
    at SSH2Stream.emit (events.js:169:7)
    at parsePacket (/Users/ron/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:3163:10)
    at SSH2Stream._transform (/Users/ron/.atom/packages/Remote-FTP/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:551:13)

Commands

     -4:26.8.0 core:move-left (atom-text-editor.editor.is-focused)
     -4:24.7.0 core:move-right (atom-text-editor.editor.is-focused)
  2x -4:24 core:backspace (atom-text-editor.editor.is-focused)
  2x -4:20.9.0 core:save (atom-text-editor.editor.is-focused)
     -3:42.1.0 remote-ftp:disconnect (atom-text-editor.editor.is-focused)
  2x -3:15.6.0 core:move-left (atom-text-editor.editor.is-focused)
     -3:15.1.0 core:backspace (atom-text-editor.editor.is-focused)
     -3:12.1.0 core:save (atom-text-editor.editor.is-focused)
     -3:05.5.0 remote-ftp:connect (atom-text-editor.editor.is-focused)
  2x -1:15.7.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "remote-edit"
    ]
  },
  "Remote-FTP": {
    "hideLocalWhenDisplayed": true
  }
}

Installed Packages

# User
Remote-FTP, v0.8.3
atom-jshint, v2.0.0

# Dev
No dev packages

@GitarMan That's very odd. Could you try amending /lib/client.js and before line 746 add in a console.log(dir, watch) ( see below ). Then restart atom.

When it's restarted go to View > Developer > Toggle Developer Tools. Then when you try connecting to your server it should log both of the properties, if you could let me know what they return when an error is thrown that would be great.

watchData.forEach(function(watch) {
                                console.log(dir, watch); // this 
                var fileName = Path.resolve(dir, watch);

having this issue as well

@EJ207, are you still having this issue in the latest update?

Problems have all been resolved for me! For a while I was about to ditch this plugin because it was happening very consistenly that processed css files and maps were being dropped. Now we are good. But I saw you also added the ability to just add a directory, could you give and example of what we should do to have that work?

@robhuska Sure, all you need to do is reference the directory e.g

"watch":[
    "./js"
]

This will reference the js directory in the root of the project folder.

Edit: Will update the configurations in the read me

This should be sorted now, if anyone is having issues with this still leave a commend and I'l re open. Also if anyone has questions about the watch functionality just open another issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xabispacebiker picture xabispacebiker  路  5Comments

matthew-e-brown picture matthew-e-brown  路  6Comments

eulogy14 picture eulogy14  路  7Comments

peterbode1989 picture peterbode1989  路  3Comments

lukecywon picture lukecywon  路  6Comments