{"id":21906655,"url":"https://github.com/enlight/electron-node-pre-gyp-fix","last_synced_at":"2026-04-12T21:43:11.027Z","repository":{"id":137247280,"uuid":"50413655","full_name":"enlight/electron-node-pre-gyp-fix","owner":"enlight","description":"NodeJS module that monkey patches node-pre-gyp to make it work with Electron","archived":false,"fork":false,"pushed_at":"2016-02-05T16:20:46.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-27T07:43:17.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/enlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-26T08:09:03.000Z","updated_at":"2016-08-03T09:00:32.000Z","dependencies_parsed_at":"2023-04-27T20:47:27.788Z","dependency_job_id":null,"html_url":"https://github.com/enlight/electron-node-pre-gyp-fix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-node-pre-gyp-fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-node-pre-gyp-fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-node-pre-gyp-fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-node-pre-gyp-fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enlight","download_url":"https://codeload.github.com/enlight/electron-node-pre-gyp-fix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244921638,"owners_count":20532297,"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":[],"created_at":"2024-11-28T16:54:11.559Z","updated_at":"2026-04-12T21:43:05.994Z","avatar_url":"https://github.com/enlight.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-node-pre-gyp-fix\n\n**NOTE**: I strongly recommend using the `node-pre-gyp` workaround in\n[electron-rebuild](https://github.com/electronjs/electron-rebuild) instead, as the monkey-patching\nthis module performs doesn't appear to work with `node-inspector`.\n\n## Overview\n[node-pre-gyp](https://github.com/mapbox/node-pre-gyp) is used by some NPM packages with native\ndepedencies (e.g. `sqlite3`, `node-inspector`) to save end-users the trouble of compiling those\nnative dependencies. However if you wish to use any of these NPM packages in\n[Electron](https://github.com/atom/electron) you have to recompile them for your particular\nversion of Electron. Unfortunately `node-pre-gyp` can't find the native depedencies you've compiled\nbecause it looks for them in the wrong place. There are pending PRs ([#187](https://github.com/mapbox/node-pre-gyp/pull/187) and\n[#177](https://github.com/mapbox/node-pre-gyp/pull/177)) to address this issue but so far they've received\nno response from the maintainers. Meanwhile developers using Electron get tripped up by this issue\nover and over again. This package aims to provide an easy to use (and hopefully robust) workaround\nuntil one of the aforementioned PRs finally gets merged in.\n\n## Usage\n\nInstall the package:\n```shell\nnpm install enlight/electron-node-pre-gyp-fix --save\n```\n\nThen install the fix before requiring `node-pre-gyp` or any modules that require it:\n```javascript\nrequire('electron-node-pre-gyp-fix').install();\n```\nThe fix must be installed once in every Electron process, and should be done as early as possible\nduring the initializion of a process.\n\n## How it works\n\nWhen the `install()` function is invoked it monkey-patches `Module.prototype._compile()` so that\nwhen `node-pre-gyp/lib/util/versioning.js` is compiled the `evaluate()` function that's exported\nby that module is monkey-patched to do the right thing when invoked within an Electron process.\nNote that it doesn't matter how many copies of `node-pre-gyp` are installed in your `node_modules`\ntree, all instances of the `evaluate()` function will be monkey-patched at runtime\nprovided `install()` is called before requiring `node-pre-gyp`.\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenlight%2Felectron-node-pre-gyp-fix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenlight%2Felectron-node-pre-gyp-fix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenlight%2Felectron-node-pre-gyp-fix/lists"}