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

"Must define at least one file" error

Open onemanstartup opened this issue 10 years ago • 14 comments

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.

onemanstartup avatar Jan 27 '15 22:01 onemanstartup

Hi,

Thanks, congrats you to.

What OS you use? What engine(node,v8,iojs) you use? What configurations you tried?

maksimr avatar Jan 27 '15 23:01 maksimr

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 avatar Jan 27 '15 23:01 onemanstartup

@onemanstartup can print how look this line when you run command. Also will be cool if you run resulted line in terminal.

maksimr avatar Jan 27 '15 23:01 maksimr

Uh. How do i run this? I don't familiar with vimscript. It will take time to figure out this.

onemanstartup avatar Jan 27 '15 23:01 onemanstartup

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

maksimr avatar Jan 27 '15 23:01 maksimr

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 avatar Jan 27 '15 23:01 onemanstartup

@onemanstartup Thanks! Now try run this command in terminal

maksimr avatar Jan 27 '15 23:01 maksimr

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.

onemanstartup avatar Jan 27 '15 23:01 onemanstartup

Hm.. try simple run node /Users/onemanstartup/Code/dotfiles/vim2/bundle/vim-jsbeautify/plugin/beautify.min.js

maksimr avatar Jan 27 '15 23:01 maksimr

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

onemanstartup avatar Jan 27 '15 23:01 onemanstartup

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"

maksimr avatar Jan 27 '15 23:01 maksimr

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)

onemanstartup avatar Jan 28 '15 00:01 onemanstartup

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"

maksimr avatar Jan 28 '15 00:01 maksimr

It's the same Must define at least one file

onemanstartup avatar Jan 28 '15 00:01 onemanstartup