{"id":14976786,"url":"https://github.com/bellisario/hostname-patcher","last_synced_at":"2026-02-27T13:34:18.182Z","repository":{"id":37997522,"uuid":"499212154","full_name":"Bellisario/hostname-patcher","owner":"Bellisario","description":"Patches os.hostname() for Windows 7 devices using a not officially Node.js supported version","archived":false,"fork":false,"pushed_at":"2023-02-26T18:00:47.000Z","size":70,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T08:41:42.591Z","etag":null,"topics":["hostname","nodejs","patch","windows-7"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bellisario.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Bellisario"}},"created_at":"2022-06-02T16:35:12.000Z","updated_at":"2024-06-27T05:23:10.000Z","dependencies_parsed_at":"2024-06-20T23:35:50.817Z","dependency_job_id":null,"html_url":"https://github.com/Bellisario/hostname-patcher","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"3cf4907e1a24cded81f8208231d83f5ade0ccc28"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bellisario%2Fhostname-patcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bellisario%2Fhostname-patcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bellisario%2Fhostname-patcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bellisario%2Fhostname-patcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bellisario","download_url":"https://codeload.github.com/Bellisario/hostname-patcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238561044,"owners_count":19492630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hostname","nodejs","patch","windows-7"],"created_at":"2024-09-24T13:54:27.455Z","updated_at":"2025-10-27T21:31:26.269Z","avatar_url":"https://github.com/Bellisario.png","language":"JavaScript","funding_links":["https://github.com/sponsors/Bellisario"],"categories":[],"sub_categories":[],"readme":"# Hostname Patcher [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Opened Issues][IssuesIMGURL]][IssuesURL] [![Monthly Downloads][DownloadsIMGURL]][NPMURL]\n\n[NPMURL]: https://npmjs.org/package/hostname-patcher \"npm\"\n[NPMIMGURL]: https://img.shields.io/npm/v/hostname-patcher.svg?style=flat\n[BuildStatusURL]: https://github.com/Bellisario/hostname-patcher/actions/workflows/publish.yml \"Publish Status\"\n[BuildStatusIMGURL]: https://github.com/Bellisario/hostname-patcher/workflows/Publish/badge.svg\n[LicenseURL]: https://github.com/Bellisario/hostname-patcher/LICENSE \"MIT License\"\n[LicenseIMGURL]: https://img.shields.io/github/license/Bellisario/hostname-patcher\n[IssuesURL]: https://github.com/Bellisario/hostname-patcher/issues \"Opened Issues\"\n[IssuesIMGURL]: https://img.shields.io/github/issues/Bellisario/hostname-patcher\n[DownloadsIMGURL]: https://img.shields.io/npm/dm/hostname-patcher \"Monthly Downloads\"\n\n\u003e Patches `os.hostname()` for Windows 7 devices using a not officially Node.js supported version\n\n## Installation\n\n```bash\nnpm install hostname-patcher\n```\n\n## Use cases\n\nFor some strange reason, `os.hostname()` is always broken if you're using a version of Node.js not officially supported in Windows 7 (v14.x.x and above), so, this module aims to keep it working.\n\n\u003e __News:__ Now also patched devices will have the real hostname, instead of the default \"localhost\".\n\n## Don't want to use it? (Worried about adding this?)\n\nYou'll not have any problem using this patch, because it checks if it's needed before doing its work (see [here](https://github.com/Bellisario/hostname-patcher/blob/39645b3ba7a99aca39f60f59e7f51e2124522994/lib/index.js#L6)).\n\n## How to use\n\n### Common.js\nTo use with Common.js, just require it without even any variable assignment:\n\n```js\n// require patch first\nrequire('hostname-patcher');\n// then os\nconst os = require('os');\n// or module using os module\nconst { moduleUsingOS } = require('example');\n\n// will output your real hostname if patch and if not\nconsole.log(os.hostname());\n```\n\n### ES6\n\nTo use as an ES6 module, just import it:\n\n```js\n// import patch first\nimport 'hostname-patcher';\n// then os\nimport os from 'os';\n// or module using os module\nimport { moduleUsingOS } from 'example';\n\n// will output your real hostname if patch and if not\nconsole.log(os.hostname());\n```\n\n\u003e All examples available in the [examples folder](https://github.com/Bellisario/hostname-patcher/tree/master/examples).\n\n## Tested modules\n\n- ~~[Nodemailer](https://github.com/nodemailer/nodemailer) (Common.js example [here](https://github.com/Bellisario/hostname-patcher/blob/master/examples/Common.js/nodemailer.js) and ES6 [here](https://github.com/Bellisario/hostname-patcher/blob/master/examples/ES6/nodemailer.mjs))~~ (not anymore required because the last version [seems to have a fallback](https://github.com/nodemailer/nodemailer/blob/e3cc93a9c20939b209c804857c75aea0d3305913/lib/smtp-connection/index.js#L1773-L1780))\n\n- __Let us know this patch is useful for other modules__\n\n## For modules builders\n\nEven if single projects can use this patch individually, would be great if modules themselves start using it, because it's a lot better for users experience and more practical.\\\nI know that this error occurs because these new Node.js versions are not anymore officially supported by Windows 7, but still today is a very usable and light OS for a lot people, so, please, keep supporting it, even if the Node.js community (but not everybody) want anymore.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbellisario%2Fhostname-patcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbellisario%2Fhostname-patcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbellisario%2Fhostname-patcher/lists"}