Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install instruction on windows 7? #14

Closed
gilbertwyw opened this issue Jan 21, 2013 · 15 comments
Closed

Install instruction on windows 7? #14

gilbertwyw opened this issue Jan 21, 2013 · 15 comments
Assignees
Labels

Comments

@gilbertwyw
Copy link

Do I need to install any node module in order to use this plugin?

I got the follow error when i format the code:
module.js:340
throw err;
^
Error: Cannot find module 'C:\Users\Gilbert'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

My "home" should be 'C:\Users\Gilbert Wong' instead.
And I've tried to symlink to just 'Gilbert' but didn't work.

BTW, in the source it seems "vimfiles/" is not one of the places the ".editorconfig" will be looked for. Any plan to support this?

Please help. Thanks.

@maksimr
Copy link
Owner

maksimr commented Jan 21, 2013

Hi.

To use this plugin you only need to have a jsbeautifier.
It comes as a submodule with the plugin, but you have selected to install it separately and through the property 'path' to . editorconfig (or global variable) to configure path to it.

I honestly did not check how it works on Windows, try to fix it.

P.S. If it is not difficult to write a version of the node and vim.

Thanks!

@gilbertwyw
Copy link
Author

Thanks for your promptly reply.

Here's my vim version:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2010 17:51:38)
MS-Windows 32-bit console version
Included patches: 1-46
Compiled by Bram@KIBAALE
Big version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +gettext/dyn -hangul_input +iconv/dyn
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
+multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl
+persistent_undo -postscript +printer -profile -python -python3 +quickfix
+reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime
+statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white
-tcl -tgetent -termresponse +textobjects +title -toolbar +user_commands
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore
+wildmenu +windows +writebackup -xfontset -xim -xterm_save -xpm_w32
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME_vimrc"
2nd user vimrc file: "$VIM_vimrc"
user exrc file: "$HOME_exrc"
2nd user exrc file: "$VIM_exrc"
Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 /Fo.\ObjC/ /Ox /GL -DNDEBUG /Zl /MT -DDYNAMIC_ICONV -DDYNAMIC
_GETTEXT -DFEAT_BIG /Fd.\ObjC/ /Zi
Linking: link /RELEASE /nologo /subsystem:console /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:i386 /nodefaultlib libc
mt.lib user32.lib /PDB:vim.pdb -debug

and node.js version:
v0.8.16

One more thing, I installed "vim-jsbeautify" through Pathogen.

@maksimr
Copy link
Owner

maksimr commented Jan 22, 2013

Thank you!! I'll try to fix it as soon as free time. :)

@peterfoldi
Copy link
Contributor

The plugin works for me in Windows8. The error looks more node.js related than something from the plugin. The 'home directory' in the error is probably trunked at the space character in the directory name so the symlink doesn't solve that. You can try also this:
http://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows
"Finally I use the environment variable NODE_PATH to reference the global module path, set NODE_PATH=C:\Documents and Settings\DevUser\Application Data\npm\node_modules, and it works as expected. It's strange that globally installed modules are positioned in '%USERPROFILE%\Application Data\npm\node_modules' on Windows, meanwhile, there cannot be quotation marks in NODE_PATH."

@gilbertwyw
Copy link
Author

Thanks for your kindly help but I still have the same error.

I set the environment variable "NODE_PATH" like "C:\Users\Gilbert Wong\AppData\Roaming\npm\node_modules"
Please let me know should you need more information.

@maksimr
Copy link
Owner

maksimr commented Mar 16, 2013

@gilbertwyw hello!
Are you solved the problem?

@gilbertwyw
Copy link
Author

Sorry, no.
Have just updated the plugin today and retried again but still facing the path issue as last time:

module.js:340
    throw err;
          ^
Error: Cannot find module 'C:\Users\Gilbert'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:903:3

where I have the following in the PATH

C:\Users\Gilbert Wong\AppData\Roaming\npm

It's my office PC and someone else set it up like this.

node --version

v0.10.0

npm --version

1.2.14

I'm really not familiar with Windows environment but I have to use it in the office.
Please let me know if there's more information you want to know.

Thanks for your help.

@maksimr
Copy link
Owner

maksimr commented Apr 28, 2013

By the way as an option you can try v8 instead nodejs :)

@jaxbot
Copy link

jaxbot commented May 6, 2013

The statement in beautify.js:

if (path.charAt(0) !== '/') {
       path = global.process.cwd() + '/' + path; // make relative path
}

Doesn't fare so well on Windows based systems. It's an easy fix, though, if replaced with a check for indexOf(":/") or the like.

Not important, but FYI for any other Windows users out there who get the require() problem

@maksimr
Copy link
Owner

maksimr commented May 6, 2013

Thanks for the tip! I think I need to find the time and see what is happening on the Windows :)

@ghost ghost assigned maksimr May 6, 2013
@jaxbot
Copy link

jaxbot commented May 6, 2013

Basically, what's happening is you're checking if it's a absolute path by seeing if the first character is a /. That works fine on Unix, since all absolute paths start with a "/", e.g. /home/user, /var/www, etc. On Windows, they start with a protocol or drive, such as C:\Users\user, D:\something, etc. So it's probably more safe to check if the second character is a column. Either way, for Windows peeps, it's an easy fix if they want to just change it on their local version

@gilbertwyw
Copy link
Author

Sorry for taking so long to reply. But it's my office PC and it's been reinstalled (which i need to setup vim & this plugin again) so I need some time to see if the problem's still there.

Thanks to both of you guys for taking time to look into the issue.

@edmistond
Copy link
Contributor

I ran into this problem as well, so I went ahead and fixed this in my own fork. It seems to be working correctly on my Windows 7 workstation at work, but I won't be able to test it on OS X or Linux at home until later tonight or next week.

Maksim, would you like a pull request for the fix after I can confirm I didn't break anything?

Thanks for an awesome plugin! :)

@maksimr
Copy link
Owner

maksimr commented May 24, 2013

Wow! Yes! Thank you very much!!!
I look forward to pull request from you (@edmistond) ! :)

👍

@jaxbot
Copy link

jaxbot commented May 24, 2013

Yep, @edmistond has the same fix I have to make it work on Windows based file systems, so there's a +1 to testify it works. Thanks @edmistond !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants