Can't open file /tmp/faker.json
setup function:
local status_ok, lab = pcall(require, "lab")
if not status_ok then
return
end
lab.setup({
code_runner = {
enabled = true,
},
quick_data = {
enabled = true,
}
})
I ran "cd js && npm ci" in the plugin directory. When opening a file in neovim I receive the error:
Error executing vim.schedule lua callback: Vim:E484: Can't open file /tmp/faker.json
stack traceback:
[C]: in function 'readfile'
...site/pack/packer/opt/lab.nvim/lua/lab/quick_data_cmp.lua:33: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Thanks for reporting this @catgoose, appreciate it. There seems to be two issues at play here:
-
It seems the faker.json isn't being generated on your system. (or perhaps it's unreadable) Are you able to confirm if
/tmp/faker.jsonexists? -
The error handling around loading that file is also failing.
As a step one I've released a hotfix (v0.2.2) with the following update: https://github.com/0x100101/lab.nvim/pull/4/commits/4270259f2ee488db6213aad01d934b5d696cbcbe
This fixes the check for the existence of the faker.json file so that the error can be handled properly. (Today I learned 0 is truthy in Lua.)
I'll continue to try to reproduce the issue with generating the file itself.
If you have a minute you could try running node js/quick_data/quick_data.js from within the plugin dir to see if any errors are produced.
/tmp/faker.json does not exit
Running node js/quick_data/quick_data.js produces an error:
(node:668961) UnhandledPromiseRejectionWarning: TypeError: Object.hasOwn is not a function
at generate (file:///home/jtye/.local/share/nvim/site/pack/packer/start/lab.nvim/js/quick_data/quick_data.js:61:14)
at file:///home/jtye/.local/share/nvim/site/pack/packer/start/lab.nvim/js/quick_data/quick_data.js:90:1
(Use `node --trace-warnings ...` to show where the warning was created)
(node:668961) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:668961) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Using node 14.18.0
Thanks! Okay that explains it. Right now there's a hard dependancy on node 16.10.0 or higher (https://github.com/0x100101/lab.nvim#requirements)
Off the top of my head I'm thinking I'll:
- Add a node version check to notify the user if there's a problem. (maybe a check-health type thing)
- Look at adding better backwards compatibility.
As an aside I'm also planning to add a setup option so that we can define the exact path to various binaries (like node, python etc) used by the plug.
Thanks, I'll try with 16.10