We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Windows: Node Support
This involves solving this ticket: https://github.com/ekalinin/nodeenv/issues/53

I've already started some work on this


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pre_commit/languages/node.py`
Content:
```
1 from __future__ import unicode_literals
2 
3 import contextlib
4 import os
5 import sys
6 
7 from pre_commit.envcontext import envcontext
8 from pre_commit.envcontext import Var
9 from pre_commit.languages import helpers
10 from pre_commit.util import clean_path_on_failure
11 from pre_commit.util import cmd_output
12 from pre_commit.xargs import xargs
13 
14 
15 ENVIRONMENT_DIR = 'node_env'
16 get_default_version = helpers.basic_get_default_version
17 healthy = helpers.basic_healthy
18 
19 
20 def get_env_patch(venv):  # pragma: windows no cover
21     if sys.platform == 'cygwin':  # pragma: no cover
22         _, win_venv, _ = cmd_output('cygpath', '-w', venv)
23         install_prefix = r'{}\bin'.format(win_venv.strip())
24     else:
25         install_prefix = venv
26     return (
27         ('NODE_VIRTUAL_ENV', venv),
28         ('NPM_CONFIG_PREFIX', install_prefix),
29         ('npm_config_prefix', install_prefix),
30         ('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),
31         ('PATH', (os.path.join(venv, 'bin'), os.pathsep, Var('PATH'))),
32     )
33 
34 
35 @contextlib.contextmanager
36 def in_env(prefix, language_version):  # pragma: windows no cover
37     envdir = prefix.path(
38         helpers.environment_dir(ENVIRONMENT_DIR, language_version),
39     )
40     with envcontext(get_env_patch(envdir)):
41         yield
42 
43 
44 def install_environment(
45         prefix, version, additional_dependencies,
46 ):  # pragma: windows no cover
47     additional_dependencies = tuple(additional_dependencies)
48     assert prefix.exists('package.json')
49     directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
50 
51     env_dir = prefix.path(directory)
52     with clean_path_on_failure(env_dir):
53         cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', env_dir]
54         if version != 'default':
55             cmd.extend(['-n', version])
56         cmd_output(*cmd)
57 
58         with in_env(prefix, version):
59             helpers.run_setup_cmd(
60                 prefix,
61                 ('npm', 'install', '-g', '.') + additional_dependencies,
62             )
63 
64 
65 def run_hook(prefix, hook, file_args):  # pragma: windows no cover
66     with in_env(prefix, hook['language_version']):
67         return xargs(helpers.to_cmd(hook), file_args)
68
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pre_commit/languages/node.py b/pre_commit/languages/node.py
--- a/pre_commit/languages/node.py
+++ b/pre_commit/languages/node.py
@@ -7,6 +7,7 @@
 from pre_commit.envcontext import envcontext
 from pre_commit.envcontext import Var
 from pre_commit.languages import helpers
+from pre_commit.languages.python import bin_dir
 from pre_commit.util import clean_path_on_failure
 from pre_commit.util import cmd_output
 from pre_commit.xargs import xargs
@@ -17,10 +18,17 @@
 healthy = helpers.basic_healthy
 
 
-def get_env_patch(venv):  # pragma: windows no cover
+def _envdir(prefix, version):
+    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
+    return prefix.path(directory)
+
+
+def get_env_patch(venv):
     if sys.platform == 'cygwin':  # pragma: no cover
         _, win_venv, _ = cmd_output('cygpath', '-w', venv)
         install_prefix = r'{}\bin'.format(win_venv.strip())
+    elif sys.platform == 'win32':  # pragma: no cover
+        install_prefix = bin_dir(venv)
     else:
         install_prefix = venv
     return (
@@ -28,29 +36,26 @@
         ('NPM_CONFIG_PREFIX', install_prefix),
         ('npm_config_prefix', install_prefix),
         ('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),
-        ('PATH', (os.path.join(venv, 'bin'), os.pathsep, Var('PATH'))),
+        ('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),
     )
 
 
 @contextlib.contextmanager
-def in_env(prefix, language_version):  # pragma: windows no cover
-    envdir = prefix.path(
-        helpers.environment_dir(ENVIRONMENT_DIR, language_version),
-    )
-    with envcontext(get_env_patch(envdir)):
+def in_env(prefix, language_version):
+    with envcontext(get_env_patch(_envdir(prefix, language_version))):
         yield
 
 
-def install_environment(
-        prefix, version, additional_dependencies,
-):  # pragma: windows no cover
+def install_environment(prefix, version, additional_dependencies):
     additional_dependencies = tuple(additional_dependencies)
     assert prefix.exists('package.json')
-    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
+    envdir = _envdir(prefix, version)
 
-    env_dir = prefix.path(directory)
-    with clean_path_on_failure(env_dir):
-        cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', env_dir]
+    # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx?f=255&MSPPError=-2147217396#maxpath
+    if sys.platform == 'win32':  # pragma: no cover
+        envdir = '\\\\?\\' + os.path.normpath(envdir)
+    with clean_path_on_failure(envdir):
+        cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', envdir]
         if version != 'default':
             cmd.extend(['-n', version])
         cmd_output(*cmd)
@@ -62,6 +67,6 @@
             )
 
 
-def run_hook(prefix, hook, file_args):  # pragma: windows no cover
+def run_hook(prefix, hook, file_args):
     with in_env(prefix, hook['language_version']):
         return xargs(helpers.to_cmd(hook), file_args)

{"golden_diff": "diff --git a/pre_commit/languages/node.py b/pre_commit/languages/node.py\n--- a/pre_commit/languages/node.py\n+++ b/pre_commit/languages/node.py\n@@ -7,6 +7,7 @@\n from pre_commit.envcontext import envcontext\n from pre_commit.envcontext import Var\n from pre_commit.languages import helpers\n+from pre_commit.languages.python import bin_dir\n from pre_commit.util import clean_path_on_failure\n from pre_commit.util import cmd_output\n from pre_commit.xargs import xargs\n@@ -17,10 +18,17 @@\n healthy = helpers.basic_healthy\n \n \n-def get_env_patch(venv):  # pragma: windows no cover\n+def _envdir(prefix, version):\n+    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)\n+    return prefix.path(directory)\n+\n+\n+def get_env_patch(venv):\n     if sys.platform == 'cygwin':  # pragma: no cover\n         _, win_venv, _ = cmd_output('cygpath', '-w', venv)\n         install_prefix = r'{}\\bin'.format(win_venv.strip())\n+    elif sys.platform == 'win32':  # pragma: no cover\n+        install_prefix = bin_dir(venv)\n     else:\n         install_prefix = venv\n     return (\n@@ -28,29 +36,26 @@\n         ('NPM_CONFIG_PREFIX', install_prefix),\n         ('npm_config_prefix', install_prefix),\n         ('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),\n-        ('PATH', (os.path.join(venv, 'bin'), os.pathsep, Var('PATH'))),\n+        ('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),\n     )\n \n \n @contextlib.contextmanager\n-def in_env(prefix, language_version):  # pragma: windows no cover\n-    envdir = prefix.path(\n-        helpers.environment_dir(ENVIRONMENT_DIR, language_version),\n-    )\n-    with envcontext(get_env_patch(envdir)):\n+def in_env(prefix, language_version):\n+    with envcontext(get_env_patch(_envdir(prefix, language_version))):\n         yield\n \n \n-def install_environment(\n-        prefix, version, additional_dependencies,\n-):  # pragma: windows no cover\n+def install_environment(prefix, version, additional_dependencies):\n     additional_dependencies = tuple(additional_dependencies)\n     assert prefix.exists('package.json')\n-    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)\n+    envdir = _envdir(prefix, version)\n \n-    env_dir = prefix.path(directory)\n-    with clean_path_on_failure(env_dir):\n-        cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', env_dir]\n+    # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx?f=255&MSPPError=-2147217396#maxpath\n+    if sys.platform == 'win32':  # pragma: no cover\n+        envdir = '\\\\\\\\?\\\\' + os.path.normpath(envdir)\n+    with clean_path_on_failure(envdir):\n+        cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', envdir]\n         if version != 'default':\n             cmd.extend(['-n', version])\n         cmd_output(*cmd)\n@@ -62,6 +67,6 @@\n             )\n \n \n-def run_hook(prefix, hook, file_args):  # pragma: windows no cover\n+def run_hook(prefix, hook, file_args):\n     with in_env(prefix, hook['language_version']):\n         return xargs(helpers.to_cmd(hook), file_args)\n", "issue": "Windows: Node Support\nThis involves solving this ticket: https://github.com/ekalinin/nodeenv/issues/53\n\nI've already started some work on this\n\n", "before_files": [{"content": "from __future__ import unicode_literals\n\nimport contextlib\nimport os\nimport sys\n\nfrom pre_commit.envcontext import envcontext\nfrom pre_commit.envcontext import Var\nfrom pre_commit.languages import helpers\nfrom pre_commit.util import clean_path_on_failure\nfrom pre_commit.util import cmd_output\nfrom pre_commit.xargs import xargs\n\n\nENVIRONMENT_DIR = 'node_env'\nget_default_version = helpers.basic_get_default_version\nhealthy = helpers.basic_healthy\n\n\ndef get_env_patch(venv):  # pragma: windows no cover\n    if sys.platform == 'cygwin':  # pragma: no cover\n        _, win_venv, _ = cmd_output('cygpath', '-w', venv)\n        install_prefix = r'{}\\bin'.format(win_venv.strip())\n    else:\n        install_prefix = venv\n    return (\n        ('NODE_VIRTUAL_ENV', venv),\n        ('NPM_CONFIG_PREFIX', install_prefix),\n        ('npm_config_prefix', install_prefix),\n        ('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),\n        ('PATH', (os.path.join(venv, 'bin'), os.pathsep, Var('PATH'))),\n    )\n\n\n@contextlib.contextmanager\ndef in_env(prefix, language_version):  # pragma: windows no cover\n    envdir = prefix.path(\n        helpers.environment_dir(ENVIRONMENT_DIR, language_version),\n    )\n    with envcontext(get_env_patch(envdir)):\n        yield\n\n\ndef install_environment(\n        prefix, version, additional_dependencies,\n):  # pragma: windows no cover\n    additional_dependencies = tuple(additional_dependencies)\n    assert prefix.exists('package.json')\n    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)\n\n    env_dir = prefix.path(directory)\n    with clean_path_on_failure(env_dir):\n        cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', env_dir]\n        if version != 'default':\n            cmd.extend(['-n', version])\n        cmd_output(*cmd)\n\n        with in_env(prefix, version):\n            helpers.run_setup_cmd(\n                prefix,\n                ('npm', 'install', '-g', '.') + additional_dependencies,\n            )\n\n\ndef run_hook(prefix, hook, file_args):  # pragma: windows no cover\n    with in_env(prefix, hook['language_version']):\n        return xargs(helpers.to_cmd(hook), file_args)\n", "path": "pre_commit/languages/node.py"}], "after_files": [{"content": "from __future__ import unicode_literals\n\nimport contextlib\nimport os\nimport sys\n\nfrom pre_commit.envcontext import envcontext\nfrom pre_commit.envcontext import Var\nfrom pre_commit.languages import helpers\nfrom pre_commit.languages.python import bin_dir\nfrom pre_commit.util import clean_path_on_failure\nfrom pre_commit.util import cmd_output\nfrom pre_commit.xargs import xargs\n\n\nENVIRONMENT_DIR = 'node_env'\nget_default_version = helpers.basic_get_default_version\nhealthy = helpers.basic_healthy\n\n\ndef _envdir(prefix, version):\n    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)\n    return prefix.path(directory)\n\n\ndef get_env_patch(venv):\n    if sys.platform == 'cygwin':  # pragma: no cover\n        _, win_venv, _ = cmd_output('cygpath', '-w', venv)\n        install_prefix = r'{}\\bin'.format(win_venv.strip())\n    elif sys.platform == 'win32':  # pragma: no cover\n        install_prefix = bin_dir(venv)\n    else:\n        install_prefix = venv\n    return (\n        ('NODE_VIRTUAL_ENV', venv),\n        ('NPM_CONFIG_PREFIX', install_prefix),\n        ('npm_config_prefix', install_prefix),\n        ('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),\n        ('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),\n    )\n\n\n@contextlib.contextmanager\ndef in_env(prefix, language_version):\n    with envcontext(get_env_patch(_envdir(prefix, language_version))):\n        yield\n\n\ndef install_environment(prefix, version, additional_dependencies):\n    additional_dependencies = tuple(additional_dependencies)\n    assert prefix.exists('package.json')\n    envdir = _envdir(prefix, version)\n\n    # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx?f=255&MSPPError=-2147217396#maxpath\n    if sys.platform == 'win32':  # pragma: no cover\n        envdir = '\\\\\\\\?\\\\' + os.path.normpath(envdir)\n    with clean_path_on_failure(envdir):\n        cmd = [sys.executable, '-m', 'nodeenv', '--prebuilt', envdir]\n        if version != 'default':\n            cmd.extend(['-n', version])\n        cmd_output(*cmd)\n\n        with in_env(prefix, version):\n            helpers.run_setup_cmd(\n                prefix,\n                ('npm', 'install', '-g', '.') + additional_dependencies,\n            )\n\n\ndef run_hook(prefix, hook, file_args):\n    with in_env(prefix, hook['language_version']):\n        return xargs(helpers.to_cmd(hook), file_args)\n", "path": "pre_commit/languages/node.py"}]}