Skip to content

Improve error message when platform node binaries do not exist #250

Closed

Description

@kbsezginel

I spend a while trying to create a node environment for FreeBSD11 and running into urllib.error.HTTPError: HTTP Error 404: Not Found error. This turned out to be due to missing prebuilt nodejs binary for the FreeBSD platform. It might be a good idea to improve the error message if the .tar.gz is not available.

See the related issue here.

Activity

  1. ssbarnea commented on Oct 9, 2025

    @ssbarnea
    Contributor

    @kbsezginel Today I suddenly started to get really ugly stacktrace errors from nodeenv even if I used it successfully for a very long time. While I do suspect that cause might be outside, these errors should be clearly nicely logged instead. The worst part is the URL is not even logged so the user has no clue where to look.

    ❯ uv run nodeenv --clean-src xx4
    warning: `VIRTUAL_ENV=/Users/ssbarnea/.venv` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
     * Install prebuilt node (24.10.0) ..
    Traceback (most recent call last):
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 786, in install_node_wrapped
        download_node_src(node_url, src_dir, args)
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 618, in download_node_src
        dl_contents = _download_node_file(node_url)
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 602, in _download_node_file
        return io.BytesIO(urlopen(node_url).read())
                          ~~~~~~~^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 652, in urlopen
        return urllib2.urlopen(req)
               ~~~~~~~~~~~~~~~^^^^^
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 189, in urlopen
        return opener.open(url, data, timeout)
               ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 495, in open
        response = meth(req, response)
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 604, in http_response
        response = self.parent.error(
            'http', request, response, code, msg, hdrs)
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 533, in error
        return self._call_chain(*args)
               ~~~~~~~~~~~~~~~~^^^^^^^
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 466, in _call_chain
        result = func(*args)
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 613, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 404: Not Found
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/bin/nodeenv", line 10, in <module>
        sys.exit(main())
                 ~~~~^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 1130, in main
        create_environment(env_dir, args)
        ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 1006, in create_environment
        install_node(env_dir, src_dir, args)
        ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 763, in install_node
        install_node_wrapped(env_dir, src_dir, args)
        ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 790, in install_node_wrapped
        download_node_src(node_url.replace('arm64', 'x64'),
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          src_dir, args)
                          ^^^^^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 618, in download_node_src
        dl_contents = _download_node_file(node_url)
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 602, in _download_node_file
        return io.BytesIO(urlopen(node_url).read())
                          ~~~~~~~^^^^^^^^^^
      File "/Users/ssbarnea/code/a/devtools/ansible-creator/.venv/lib/python3.13/site-packages/nodeenv.py", line 652, in urlopen
        return urllib2.urlopen(req)
               ~~~~~~~~~~~~~~~^^^^^
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 189, in urlopen
        return opener.open(url, data, timeout)
               ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 495, in open
        response = meth(req, response)
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 604, in http_response
        response = self.parent.error(
            'http', request, response, code, msg, hdrs)
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 533, in error
        return self._call_chain(*args)
               ~~~~~~~~~~~~~~~~^^^^^^^
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 466, in _call_chain
        result = func(*args)
      File "/Users/ssbarnea/.config/uv/python/cpython-3.13.8-macos-aarch64-none/lib/python3.13/urllib/request.py", line 613, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 404: Not Found
    

    I did look at https://nodejs.org/download/release/latest/ and apparently there is no macos build there and I was able to identify nodejs/node#60176 as tracking this issue.

    The question is if the logic should be improved till they address this issue?

  2. added a commit that references this issue on Sep 22, 2026
    028ebc4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions