Reputation: 1244
I'm trying to install the eslint pre-commit hook (https://github.com/pre-commit/mirrors-eslint)
This is the entry in my pre-commit file:
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v7.4.0'
hooks:
- id: eslint
However, when I run pre-commit, I get the following:
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-eslint:[email protected].
[INFO] Installing environment for https://github.com/pre-commit/mirrors-eslint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('c:\\users\\username\\appdata\\local\\programs\\python\\python38\\python.exe', '-mnodeenv', '--prebuilt', '--clean-src', '\\\\?\\C:\\Users\\username\\.cache\\pre-commit\\repow421i8dr\\node_env-default')
Return code: 1
Expected return code: 0
Output: (none)
Errors:
* Install prebuilt node (14.5.0) ..... done.
symbolic link created for \\?\C:\Users\username\.cache\pre-commit\repow421i8dr\node_env-default\Scripts\nodejs.exe <<===>> node.exe
* Install npm.js (latest) ... Traceback (most recent call last):
File "c:\users\username\appdata\local\programs\python\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\username\appdata\local\programs\python\python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\nodeenv.py", line 1462, in <module>
main()
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\nodeenv.py", line 1071, in main
create_environment(env_dir, opt)
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\nodeenv.py", line 911, in create_environment
instfunc(env_dir, src_dir, opt)
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\nodeenv.py", line 762, in install_npm_win
shutil.copy(join(src_dir, npm_ver, 'bin', 'npm.cmd'),
File "c:\users\username\appdata\local\programs\python\python38\lib\shutil.py", line 415, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "c:\users\username\appdata\local\programs\python\python38\lib\shutil.py", line 261, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '\\\\?\\C:\\Users\\username\\.cache\\pre-commit\\repow421i8dr\\node_env-default\\src\\npm-latest\\bin\\npm.cmd'
Check the log at C:\Users\username/.cache\pre-commit\pre-commit.log
I don't understand what that file is or why eslint needs it. Eslint works when I use it directly from the terminal, which confirms that it is installed as a standalone and it works as intended too.
Upvotes: 1
Views: 1111
Reputation: 70175
you should be able to reproduce this crash without pre-commit, just by using nodeenv -- try the following:
nodeenv nenv --prebuilt --clean-src
The only way that I can see that this is possible is if you have a nodeenv configuration file which has with_npm = true
and npm = ...
(some extremely old version of npm which doesn't ship an npm.cmd
file)
Could you try removing those contents from your config file? I believe it can be at any of the following places:
./tox.ini
./setup.cfg
%HOMEPATH%/.nodeenvrc
Upvotes: 0