vim-jsbeautify
vim-jsbeautify copied to clipboard
"Must define at least one file" error
Hi countryman, congrats on the holiday. I'm getting this error, tried different settings, doesn't helped.
Must define at least one file.
Run `beautify.min.js -h` for help.
Hi,
Thanks, congrats you to.
What OS you use? What engine(node,v8,iojs) you use? What configurations you tried?
I tried to install different versions of beautifiers, (tried changing editorconfig, but it seems it is not relevant) I'm using Mac OS X Yosemite, node version is v0.10.33, tried in console vim and MacVim
@onemanstartup can print how look this line when you run command. Also will be cool if you run resulted line in terminal.
Uh. How do i run this? I don't familiar with vimscript. It will take time to figure out this.
You can change this line on
echo engine." ".fnameescape(s:plugin_Root_directory."/beautify.min.js")." --js_arguments ".tmp_file_Beautifier_arg." ".opts_Beautifier_arg." ".path_Beautifier_arg)
return 1
Ok. Run through call ErrorMsg()
node /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js --js_arguments "/var/folders/hm/ng5h
j9t949s6ljmgzwng_7hh0000gp/T/vlj6gW0/0" "{\"indent_char\": \" \", \"path\": \"~/.nvim/bundle/vim-jsbeautify/plugin/lib/js/bin/j
s-beautify.js\", \"max_line_length\": \"79\", \"indent_style\": \"space\", \"indent_size\": \"2\", \"wrap-line-length\": \"79\"
, \"max_char\": \"79\"}" "/Users/onemanstartup/.nvim/bundle/vim-jsbeautify/plugin/lib/js/bin/js-beautify.js"'
@onemanstartup Thanks! Now try run this command in terminal
It tells the same thing. I cat tmp file and it is containing content of the file.
Also i ran js-beautify /var/folders/hm/ng5hj9t949s6ljmgzwng_7hh0000gp/T/vlj6gW0/0.js
and it returned content.
Hm.. try simple run node /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js
Here the error
fs.js:438
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string
at Object.fs.openSync (fs.js:438:18)
at Object.fs.readFileSync (fs.js:289:15)
at read (/Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:1462)
at /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:1581
at Object.<anonymous> (/Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:1982)
at Object.<anonymous> (/Users/onemanstartup/Code/d
Cool! now let's pass one parameter
node /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js --js_arguments "/var/folders/hm/ng5h
j9t949s6ljmgzwng_7hh0000gp/T/vlj6gW0/0"
Here there error
/Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1
s=require("fs");load=function(path){var context={},property;if(path.charAt(0)!
^
TypeError: Cannot call method 'charAt' of undefined
at load (/Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:1194)
at /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:1644
at Object.<anonymous> (/Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:1982)
at Object.<anonymous> (/Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js:1:2011)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Good! Now with empty json
node /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js --js_arguments "/var/folders/hm/ng5h
j9t949s6ljmgzwng_7hh0000gp/T/vlj6gW0/0" "{}" "/Users/onemanstartup/.nvim/bundle/vim-jsbeautify/plugin/lib/js/bin/js-beautify.js"
It's the same Must define at least one file