Skip to content

Windows support #140

Closed
Closed

Description

@techtonik

Can't create environment on Windows, because it requires compiler.

E:\grtp.co>py -m nodeenv -v .vjs -n 4.2.1
 * Install node (4.2.1)
   Downloading https://nodejs.org/dist/v4.2.1/node-v4.2.1.tar.gz
.'.' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\lib\site-packages\nodeenv.py", line 1044, in <module>
    main()
  File "C:\Python27\lib\site-packages\nodeenv.py", line 892, in main
    create_environment(env_dir, opt)
  File "C:\Python27\lib\site-packages\nodeenv.py", line 733, in create_environment
    install_node(env_dir, src_dir, opt)
  File "C:\Python27\lib\site-packages\nodeenv.py", line 609, in install_node
    build_node_from_src(env_dir, src_dir, node_src_dir, opt)
  File "C:\Python27\lib\site-packages\nodeenv.py", line 574, in build_node_from_src
    callit(conf_cmd, opt.verbose, True, node_src_dir, env)
  File "C:\Python27\lib\site-packages\nodeenv.py", line 461, in callit
    % (cmd_desc, proc.returncode))
OSError: Command ./configure "--prefix='E:\grtp.co\.vjs'" failed with error code 1

The only solution that comes into my mind is to use compiled binaries. I implemented this once for getting prerequisites for compiling Wesnoth. Perhaps this code can be reused here too:

https://bitbucket.org/techtonik/locally/src/59e387ead07120777fdbe77fd0d047904cea6b14/05.wesnoth.py?at=default&fileviewer=file-view-default

Activity

  1. ekalinin commented on Nov 3, 2015

    @ekalinin
    Owner

    Hi @techtonik

    Thanks for report.
    Yeah, nodeenv doesn't support Windows atm. (see #53)

    But nodeenv is able to install node from compiled binaries.
    Try this command (i'm not sure if it works under windows though):

    E:\grtp.co>py -m nodeenv -v .vjs -n 4.2.1 --prebuilt
  2. techtonik commented on Nov 3, 2015

    @techtonik
    ContributorAuthor

    Nice. I'd switch to that option by default. Looks like problem with 32-bit Windows:

     * Install node (4.2.1Traceback (most recent call last):
      File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
        "__main__", fname, loader, pkg_name)
      File "C:\Python27\lib\runpy.py", line 72, in _run_code
        exec code in run_globals
      File "C:\Python27\lib\site-packages\nodeenv.py", line 1044, in <module>
        main()
      File "C:\Python27\lib\site-packages\nodeenv.py", line 892, in main
        create_environment(env_dir, opt)
      File "C:\Python27\lib\site-packages\nodeenv.py", line 733, in create_environment
        install_node(env_dir, src_dir, opt)
      File "C:\Python27\lib\site-packages\nodeenv.py", line 594, in install_node
        node_url = get_node_src_url(opt.node, get_node_src_url_postfix(opt))
      File "C:\Python27\lib\site-packages\nodeenv.py", line 502, in get_node_src_url_postfix
        postfix_arch = arches[platform.machine()]
    KeyError: 'x86'
    
  3. added a commit that references this issue on Nov 3, 2015
  4. techtonik commented on Nov 3, 2015

    @techtonik
    ContributorAuthor

    Download for Windows fails, because Windows downloads have different URL structure.
    https://nodejs.org/en/blog/release/v4.2.1/

       Downloading https://nodejs.org/dist/v4.2.1/node-v4.2.1-windows-x86.tar.gz
    Traceback (most recent call last):
    ...
    urllib2.HTTPError: HTTP Error 404: Not Found
    
  5. msangel commented on Feb 9, 2016

    @msangel

    So far, please make --prebuilt mode as default on windows.
    If someone wish to build node.js, let him specify this explicitly.

  6. ekalinin commented on Feb 9, 2016

    @ekalinin
    Owner

    I believe, we need to do it for all platforms :)

  7. techtonik commented on Feb 9, 2016

    @techtonik
    ContributorAuthor

    It would be nice to merge #148 before moving further into downloads refactoring for all systems. It should be pretty easy then to take it and finish it from there.

  8. ekalinin commented on Feb 9, 2016

    @ekalinin
    Owner

    Done

  9. techtonik commented on Feb 9, 2016

    @techtonik
    ContributorAuthor

    One step closer. He-he..

  10. techtonik commented on Feb 9, 2016

    @techtonik
    ContributorAuthor

    Another fix is in #149

  11. techtonik commented on Feb 9, 2016

    @techtonik
    ContributorAuthor

    Well, the code is there, but coverage test fails, probably because Windows execution branch is not tested on Travis.

  12. neocris commented on Feb 11, 2016

    @neocris

    for me the keyerror is 'amd64' although i have a i5 core. please add support for amd64 arch. perhaps it has something to do with python for 64 bit versions since the intel 64 bit architecture was licensed from amd, therefore the 'amd64' key; the python binaries for 64 bit all have the amd64 denomination

  13. techtonik commented on Feb 11, 2016

    @techtonik
    ContributorAuthor

    @neocris what is the exact output of this command on your machine?

    python -c "import platform; print(platform.machine())"
    
  14. techtonik commented on Feb 11, 2016

    @techtonik
    ContributorAuthor

    @neocris also, do you use latest Github version?

  15. neocris commented on Feb 11, 2016

    @neocris

    @techtonik the output is "AMD64". i don't get the github question, neither have it installed. i installed nodeenv trough 'pip install' if that's what you mean

  16. 36 remaining items

  17. techtonik commented on Mar 4, 2016

    @techtonik
    ContributorAuthor

    @MCGallaspy installing from source is not an easy way. Easy way is to just download binaries, but it was reverted, because a4bf0e7 broke something on Linux.

  18. techtonik commented on Mar 4, 2016

    @techtonik
    ContributorAuthor

    @MCGallaspy try reverting code to revision MCGallaspy@cdbd415 to see what was made for prebuilt stuff. Basically node.exe is downloaded and executed ok, but it appears that npm is also needed, which was just not implemented.

  19. MCGallaspy commented on Mar 5, 2016

    @MCGallaspy

    Tried python -m nodeenv --prebuilt test from the given revision. The only contents of the test directory is an empty src directory, and I get the following traceback:

     * Install prebuilt node (5.7.1) ..Traceback (most recent call last):
      File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
        "__main__", fname, loader, pkg_name)
      File "C:\Python27\Lib\runpy.py", line 72, in _run_code
        exec code in run_globals
      File "D:\nodeenv\nodeenv.py", line 1071, in <module>
        main()
      File "D:\nodeenv\nodeenv.py", line 919, in main
        create_environment(env_dir, opt)
      File "D:\nodeenv\nodeenv.py", line 760, in create_environment
        install_node(env_dir, src_dir, opt)
      File "D:\nodeenv\nodeenv.py", line 632, in install_node
        download_node_src(node_url, src_dir, opt, prefix)
      File "D:\nodeenv\nodeenv.py", line 521, in download_node_src
        with tarfile_open(fileobj=tar_contents) as tarfile_obj:
      File "C:\Python27\Lib\contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "D:\nodeenv\nodeenv.py", line 507, in tarfile_open
        tf = tarfile.open(*args, **kwargs)
      File "C:\Python27\Lib\tarfile.py", line 1672, in open
        raise ReadError("file could not be opened successfully")
    tarfile.ReadError: file could not be opened successfully
    
  20. MCGallaspy commented on Mar 5, 2016

    @MCGallaspy

    It's because the parameter node_url in download_node_src has the value https://nodejs.org/dist/v5.7.1/win-x64/node.exe -- which obviously is not a tar file.

  21. MCGallaspy commented on Mar 5, 2016

    @MCGallaspy

    it appears that npm is also needed, which was just not implemented

    Yeah, I see what you mean. Here's a work-in-progress: https://github.com/MCGallaspy/nodeenv/commits/windows-support-2

    The command python -m nodeenv --prebuilt test at least finishes without error, but somehow I haven't unpacked the node binary into test\bin\node.exe (instead it goes to test\bin\node-<version>\node.exe) and also, as you say, npm binary needs to be downloaded. Looks like you can get them here: https://github.com/npm/npm/releases

    Short on time again, will try again later!

  22. techtonik commented on Mar 6, 2016

    @techtonik
    ContributorAuthor
  23. techtonik commented on Mar 6, 2016

    @techtonik
    ContributorAuthor

    I see that https://github.com/MCGallaspy/nodeenv/commits/windows-support-2 branch is on top of needed fixes, so yes - need a way to download and install npm, but the more pressing problem is to understand what had failed on Linux so that the changesets made so far were reverted in master branch.

  24. tylerlandas commented on Apr 10, 2016

    @tylerlandas

    Hi all. Sorry if this is not the correct place to ask, but is nodeenv supported on 64bit Win10? From this thread it seems not yet, but want to confirm. Been trying to use it without success.

  25. techtonik commented on Apr 10, 2016

    @techtonik
    ContributorAuthor

    I don't have time/project to complete this, so it is not supported.

  26. ekalinin commented on Dec 8, 2016

    @ekalinin
    Owner
  27. techtonik commented on Jan 20, 2017

    @techtonik
    ContributorAuthor

    Can be closed for now. @ekalinin can you wrap a release with these changes?

  28. ekalinin commented on Jan 20, 2017

    @ekalinin
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions