Posted By

composite on 07/30/14


Tagged

python install nodejs npm gyp


Versions (?)

Fir npm install with gyp for windows if your name is contains non-english characters.


 / Published in: Python
 

URL: https://github.com/TooTallNate/node-gyp/pull/366#issuecomment-47416841

his simple patch solves the problem when building on windows with usernames with non-ascii letters.

  1. """
  2. https://github.com/TooTallNate/node-gyp/pull/366#issuecomment-47416841
  3.  
  4. for Windows,
  5. If your windows user name is contain non-english characters, go ahead for troubleshoot npm install.
  6.  
  7. Open as your editor below,
  8. (node.js folder)\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\easy_xml.py
  9.  
  10. Search for this piece of code,
  11. """
  12. # It has changed, write it
  13. if existing != xml_string:
  14. f = open(path, 'w')
  15. f.write(xml_string)
  16. f.close()
  17. """
  18. and change to,
  19. """
  20. # It has changed, write it
  21. if existing != xml_string:
  22. f = open(path, 'w')
  23. try:
  24. xml_string = xml_string.encode(encoding)
  25. except Exception:
  26. xml_string = unicode(xml_string, 'latin-1').encode(encoding)
  27. f.write(xml_string)
  28. f.close()
  29. """
  30. If you not python guy like me, just copy code with indented space,
  31. select piece of code with intented space, and paste it. It will work.
  32. """

Report this snippet  

You need to login to post a comment.