Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Error 183 ("already exists") when installing prebuilt node #249

Closed
na-Itms opened this issue Jan 31, 2020 · 1 comment
Closed

Comments

@na-Itms
Copy link

na-Itms commented Jan 31, 2020

Hello, thanks for this tool!

I am having a puzzling issue on Windows when trying to setup a new environment. nodeenv doesn't manage to install node, as if it was trying to override an existing directory. I am using Windows 10. Here are the reproduction steps, with printed version numbers for relevant tools.

C:\Users\Nicolas\Desktop>virtualenv --version
16.7.9

C:\Users\Nicolas\Desktop>virtualenv test-env
Using base prefix 'c:\\program files\\python38'
New python executable in C:\Users\Nicolas\Desktop\test-env\Scripts\python.exe
Installing setuptools, pip, wheel...
done.

C:\Users\Nicolas\Desktop>.\test-env\Scripts\activate

(test-env) C:\Users\Nicolas\Desktop>python --version
Python 3.8.1

(test-env) C:\Users\Nicolas\Desktop>pip install nodeenv
Collecting nodeenv
  Using cached nodeenv-1.3.4-py2.py3-none-any.whl (21 kB)
Installing collected packages: nodeenv
Successfully installed nodeenv-1.3.4

(test-env) C:\Users\Nicolas\Desktop>nodeenv --version
1.3.4

(test-env) C:\Users\Nicolas\Desktop>nodeenv -p
 * Install prebuilt node (13.7.0) ....
Traceback (most recent call last):
  File "c:\program files\python38\Lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files\python38\Lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Nicolas\Desktop\test-env\Scripts\nodeenv.exe\__main__.py", line 7, in <module>
  File "c:\users\nicolas\desktop\test-env\lib\site-packages\nodeenv.py", line 1113, in main
    create_environment(env_dir, opt)
  File "c:\users\nicolas\desktop\test-env\lib\site-packages\nodeenv.py", line 936, in create_environment
    install_node(env_dir, src_dir, opt)
  File "c:\users\nicolas\desktop\test-env\lib\site-packages\nodeenv.py", line 700, in install_node
    install_node_wrapped(env_dir, src_dir, opt)
  File "c:\users\nicolas\desktop\test-env\lib\site-packages\nodeenv.py", line 728, in install_node_wrapped
    copy_node_from_prebuilt(env_dir, src_dir, opt.node)
  File "c:\users\nicolas\desktop\test-env\lib\site-packages\nodeenv.py", line 612, in copy_node_from_prebuilt
    os.makedirs(dest)
  File "c:\users\nicolas\desktop\test-env\lib\os.py", line 221, in makedirs
    mkdir(name, mode)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'c:\\users\\nicolas\\desktop\\test-env\\Scripts'

Of course the folder exists, as it's a part of the python virtualenv. As you can see I did not try anything too fancy, and there are no spaces in my paths.

Thanks in advance for the help, and let me know if you want me to test other things.

@a1s
Copy link

a1s commented Feb 4, 2020

The bug has been introduced in bfe13b3 which changed calls of the internal utility function mkdir to os.makedirs.

Here's a patch to revert that: nodeenv.patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants