ekalinin/nodeenv

cannot install node 14.10.0 in macbook

hkbluesky opened this issue · 3 comments

% nodeenv --node=14.10.0 --prebuilt env-14.10.0-prebuilt

  • Install prebuilt node (14.10.0) .
    Traceback (most recent call last):
    File "/usr/local/bin/nodeenv", line 11, in
    load_entry_point('nodeenv==1.6.0', 'console_scripts', 'nodeenv')()
    File "/Library/Python/2.7/site-packages/nodeenv-1.6.0-py2.7.egg/nodeenv.py", line 1079, in main
    create_environment(env_dir, opt)
    File "/Library/Python/2.7/site-packages/nodeenv-1.6.0-py2.7.egg/nodeenv.py", line 956, in create_environment
    install_node(env_dir, src_dir, opt)
    File "/Library/Python/2.7/site-packages/nodeenv-1.6.0-py2.7.egg/nodeenv.py", line 721, in install_node
    install_node_wrapped(env_dir, src_dir, opt)
    File "/Library/Python/2.7/site-packages/nodeenv-1.6.0-py2.7.egg/nodeenv.py", line 743, in install_node_wrapped
    download_node_src(node_url, src_dir, opt)
    File "/Library/Python/2.7/site-packages/nodeenv-1.6.0-py2.7.egg/nodeenv.py", line 570, in download_node_src
    dl_contents = io.BytesIO(urlopen(node_url).read())
    File "/Library/Python/2.7/site-packages/nodeenv-1.6.0-py2.7.egg/nodeenv.py", line 606, in urlopen
    return urllib2.urlopen(req)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
    return self._call_chain(*args)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 404: Not Found

I am having similar issues. In my case, I found that there was no prebuilt binary for my system. Nodeenv is trying to download this file, but it does not exist: https://nodejs.org/download/release/v17.5.0/node-v17.5.0-linux-x86.tar.gz

Do you have an m1 chip? it seems there's no prebuilt binary for this architecture.

x3l51 commented

I have a similar issue and want to share what I tried.

The urlib 404 occurs because there's no binaries for darwin arm64 for versions lower than 16.latest I think. You can check all versions here.

You can try building node from source instead of using a prebuilt with --source -j 4, similar to the make syntax. For me this still fails on multiple ends when I try to run it.

The only thing that has helped me was running older node versions with rosetta compatibility mode. This doesn't work with nodeenv though so that's not a lot of help either.

So this is still a bit of a workaround but you can start terminal with rosetta support so everything run within it, will use the intel binaries and does not rely on arm64 binaries.

For this

  • go into you applications/utilities folder
  • create a duplicate of terminal
  • rename it to terminalRosetta or whatever else you'd like to call it
  • right click terminalRosetta
  • get Info
  • activate the tickbox for "Open using Rosetta"
  • run terminalRosetta (double click it)

Screenshot 2022-04-27 at 10 54 52

And then run your script or nodeenv directly from within terminalRosetta. I just tested this and for me it worked with nodeenv using node 12.22.12.

So as long as there are no binaries for darwin arm64 for node versions <16.* this seems to be your best bet.