Skip to content

Commit

Permalink
Merge pull request #1122 from henryykt/bugfix/windows_node_path
Browse files Browse the repository at this point in the history
Fix NODE_PATH on win32
  • Loading branch information
asottile committed Aug 27, 2019
2 parents 7f90039 + b0c7ae4 commit 47fb42c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pre_commit/languages/node.py
Expand Up @@ -24,18 +24,20 @@ def _envdir(prefix, version):


def get_env_patch(venv): # pragma: windows no cover
lib_dir = 'lib'
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)
lib_dir = 'Scripts'
else: # pragma: windows no cover
install_prefix = venv
return (
('NODE_VIRTUAL_ENV', venv),
('NPM_CONFIG_PREFIX', install_prefix),
('npm_config_prefix', install_prefix),
('NODE_PATH', os.path.join(venv, 'lib', 'node_modules')),
('NODE_PATH', os.path.join(venv, lib_dir, 'node_modules')),
('PATH', (bin_dir(venv), os.pathsep, Var('PATH'))),
)

Expand Down

0 comments on commit 47fb42c

Please sign in to comment.