Return to Snippet

Revision: 67023
at July 30, 2014 10:36 by composite


Initial Code
"""
  https://github.com/TooTallNate/node-gyp/pull/366#issuecomment-47416841
  
  for Windows,
  If your windows user name is contain non-english characters, go ahead for troubleshoot npm install.
  
  Open as your editor below,
  (node.js folder)\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\easy_xml.py
  
  Search for this piece of code,
  """
  # It has changed, write it
  if existing != xml_string:
    f = open(path, 'w')
    f.write(xml_string)
    f.close()
  """
  and change to,
  """
  # It has changed, write it
  if existing != xml_string:
    f = open(path, 'w')
    try:
      xml_string = xml_string.encode(encoding)
    except Exception:
      xml_string = unicode(xml_string, 'latin-1').encode(encoding)
    f.write(xml_string)
    f.close()
  """
  If you not python guy like me, just copy code with indented space,
  select piece of code with intented space, and paste it. It will work.
  """

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

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

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

Initial Tags
python

Initial Language
Python