neovim/node-host

List argument must be an Array of Buffers

SevereOverfl0w opened this issue · 16 comments

When trying to :UpdateRemotePlugins node-host has started failing for js, I see this in my .nvimlog:

2016/02/15 12:29:49 [info @ main:523] 19017 - Starting Neovim main loop.
2016/02/15 12:29:52 [error @ forward_stderr:333] 19017 - Channel 3 stderr: events.js:154
      throw er; // Unhandled 'error' event
      ^

TypeError: list argument must be an Array of Buffers
    at Function.Buffer.concat (buffer.js:229:13)
    at BufferList.copy (/home/dominic/.config/nvim/plugged/node-host/node_modules/bl/bl
2016/02/15 12:29:52 [error @ forward_stderr:333] 19017 - Channel 3 stderr: .js:118:21)
    at BufferList.slice (/home/dominic/.config/nvim/plugged/node-host/node_modules/bl/bl.js:93:15)
    at Object.encode (/home/dominic/.config/nvim/plugged/node-host/node_modules/msgpack5/index.js:188:18)
    at Encoder._transform (/home/domin
2016/02/15 12:29:52 [error @ forward_stderr:333] 19017 - Channel 3 stderr: ic/.config/nvim/plugged/node-host/node_modules/msgpack5/lib/streams.js:37:25)
    at Encoder.Transform._read (/home/dominic/.config/nvim/plugged/node-host/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at Encoder.Transform._write (/home
2016/02/15 12:29:52 [error @ forward_stderr:333] 19017 - Channel 3 stderr: /dominic/.config/nvim/plugged/node-host/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/home/dominic/.config/nvim/plugged/node-host/node_modules/readable-stream/lib/_stream_writable.js:279:12)
    at writeOrBuffer (/home/dom
2016/02/15 12:29:52 [error @ forward_stderr:333] 19017 - Channel 3 stderr: inic/.config/nvim/plugged/node-host/node_modules/readable-stream/lib/_stream_writable.js:266:5)
    at Encoder.Writable.write (/home/dominic/.config/nvim/plugged/node-host/node_modules/readable-stream/lib/_stream_writable.js:211:11)

I'm seeing this as well ... Just pulled from head and built on Ubuntu.

nvim-log

Huh, I'm not getting this issue on the most recent [dev] build of neovim. Perhaps if you have time you could try installing from neovim HEAD? Otherwise my question is whether you have any node rplugins. The API for node-host recently changed in a very backwards-incompatible way.

I use nvim-refactor.js, but that is a recent plugin, and I believe using the latest api

I'll try updating my neovim.

Before update, nvim --version output:

NVIM v0.1.2-398-g8f22031
Build type: Dev

Post update, output:

NVIM v0.1.3-138-g00347ec
Build type: Dev

Still unable to run.

Hmm, what was the API change to node-host? I'm the author of a nvim plugin using node-host, so it may be that my plugin is broken because of this change...

snoe commented

@nhynes I think I narrowed this down to a change between node 5.0.0 and 5.6.0 - 5.0 works and 5.6 gives this error.

snoe commented

@bigfish I believe this ce637f5 is the api change commit - *Sync handlers now take a callback. #5

It's working for me on node 5.4.1.. on mac at least.

I'm not using any *Sync calls, so I don't think that can be the cause. Also, the plugin is working with newest node-host, so I don't think it can be that.

Arch Linux node versions 5.5 and 5.6 do not work for me. It's possible 5.4 introduced the issues, but I was using this with 5.5 not long ago (I believe, I don't have 5.4 in my package cache).

This looks like the node commit that breaks it
nodejs/node@58d67e26a2

looks like the bl module in breaking because of it. which is part of Neovim itself.
Not sure if this is relevant.. rvagg/bl#13

so more of a Neovim issue than nodehost one? Perhaps an issue should be filed there instead.

Yeah, that issue is definitely relevant. That check that was introduced into the node code is incompatible with bl. It's a major flaw in bl that it doesn't work.

Now that node are checking types more seriously, it's stopped bl from working in that function.

The issue is downstream. It's possibly fixed in the latest version of msgpack, but msgpack5rpc is using an outdated version. I feel some pressure may need applying to @tarruda to make this happen. https://github.com/tarruda/node-msgpack5rpc

I've made a few PRs, and made a few forks, you can fix this locally if you're in a pickle like I was:

cd ~/.config/nvim/plugged/node-host
rm -rf node_modules
npm i -S https://github.com/SevereOverfl0w/node-client.git
npm install

In writing: Go to node-host, rm your node_modules directory (clean the old and bad cached modules), switch to my node-client fork temporarily, and then install all your modules.

Disclaimer: When node-host is fixed, to update you will need to do this:

git checkout -- package.json

before updating.

Latest version of node-client is published, updating the version will fix this issue.

yes, updating to latest node-client works for me, too. Thanks, @SevereOverfl0w !
But, we still need to get @nhynes to update
"neovim-client": "^1.0.7" -->
"neovim-client": "^1.0.8"
before the issue can really be closed.

Yep, sorry for the delay. I'm scheduled to do node-* stuff this afternoon.

🎈 No worries, thank you for helping us track this down and resolve it.

Done. Thanks again for finding and fixing the bug!