vim-node icon indicating copy to clipboard operation
vim-node copied to clipboard

"E121: Undefined variable: b:node_root" error

Open mMontu opened this issue 7 years ago • 7 comments

First of all, thanks for sharing this nice plugin!

When issuing Ctrl+p/n or [+I on some files (which ends with .js) I get the following error:

    E121: Undefined variable: b:node_root
    Error detected while processing function node#lib#find[8]..<SNR>233_absolutize:
    line    7:
    E15: Invalid expression: b:node_root . "/node_modules/" . a:name  

The variable b:node_root is indeed undefined on the files which display errors. On the files where the problem doesn't ocurr the variable is defined.

mMontu avatar Nov 01 '16 15:11 mMontu

Thanks for taking the time to let me know and sorry for the belated response. I should really look into this! :)

moll avatar Apr 04 '17 16:04 moll

Glad you liked. The code simplification in the PR solved the problem for me, but I may have missed some corner case.

mMontu avatar Apr 24 '17 16:04 mMontu

I think I'm having this error too. It's been bugging me for a while and I just today typed the right thing in to google to lead me here.

johnelliott avatar May 26 '17 21:05 johnelliott

@johnelliott I've created a pull request with a possible fix. If you'd like to test it, you can clone my E121 branch: https://github.com/mMontu/vim-node/tree/E121

mMontu avatar May 29 '17 12:05 mMontu

Thanks @mMontu, I read the diff a few days ago. I'll give it a shot. Currently I'm seeing if I was even using the plugin at all. For background, I've been removing plugins in general, nothing against this one 😇

johnelliott avatar May 29 '17 14:05 johnelliott

Hi, is there any news on this? This problem appears for me when trying to tab complete. I can post more information if needs be.

benswinburne avatar Mar 04 '18 16:03 benswinburne

This happens for me whenever I tab autocomplete a file with a shebang of #!/usr/bin/node which doesn't live in a dir with a node_modules sub folder.

The fix is to create a node_modules folder, but a patch would be nice.

robincafolla avatar Aug 03 '18 09:08 robincafolla