{"id":13732455,"url":"https://github.com/sindresorhus/run-node","last_synced_at":"2025-04-04T12:08:55.061Z","repository":{"id":55414730,"uuid":"63495560","full_name":"sindresorhus/run-node","owner":"sindresorhus","description":"Run the Node.js binary no matter what","archived":false,"fork":false,"pushed_at":"2021-01-24T07:33:18.000Z","size":13,"stargazers_count":138,"open_issues_count":4,"forks_count":10,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T11:09:44.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2016-07-16T17:54:02.000Z","updated_at":"2024-09-06T09:45:55.000Z","dependencies_parsed_at":"2022-08-14T23:50:36.445Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/run-node","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frun-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frun-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frun-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frun-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/run-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246764088,"owners_count":20829838,"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-08-03T02:01:57.205Z","updated_at":"2025-04-04T12:08:55.046Z","avatar_url":"https://github.com/sindresorhus.png","language":"Shell","readme":"# run-node\n\n\u003e Run the Node.js binary no matter what\n\nYou can't always assume running `$ node file.js` will just work. The user might have the `node` binary in a non-standard location. They might be using a Node.js version manager like `nvm`, which is sourced in a subshell and not available from the outside. Or they might have `node` installed as a local dependency in an npm project. It also depends from where you're trying to run it. For example, GUI apps on macOS doesn't inherit the [`$PATH`](https://en.wikipedia.org/wiki/PATH_(variable)), so the `node` binary would not be found. Most projects that depend on Node.js just end up telling the user to manually set the full path to the `node` binary in some project specific settings. Now every project has to do this. [Ugh...](https://gist.github.com/cookrn/4015437) I prefer things to *just* work. With this module it will.\n\nThis Bash script uses some tricks to find the Node.js binary on your system and run it.\n\nCan be used from any environment that can spawn a process (Shell, Python, Ruby, Swift, Objective-C, etc).\n\n### npm\n\n#### Install\n\n```\n$ npm install run-node\n```\n\n#### Usage\n\n```\n$ ./node_modules/.bin/run-node file.js\n```\n\nOr in an [npm run script](https://docs.npmjs.com/cli/run-script):\n\n```json\n{\n\t\"start\": \"run-node file.js\"\n}\n```\n\nIf the [`node`](https://www.npmjs.com/package/node) package is found in the local `node_modules` directory (for instance, if you have it installed as a [devDependency](https://docs.npmjs.com/files/package.json#devdependencies) of your npm project), this is the `node` binary that will be used.\n\n### Manually\n\n#### Install\n\nDownload the [run-node](run-node) file:\n\n```\n$ curl -sSLO https://github.com/sindresorhus/run-node/raw/main/run-node \u0026\u0026 chmod +x run-node\n```\n\n#### Usage\n\n```\n./run-node file.js\n```\n\n#### Customizable cache path and error message\n\nThe cache path and error message are defined by the `RUN_NODE_CACHE_PATH` and `RUN_NODE_ERROR_MSG` environment variables. You could use them in a script or add them to your `~.bashrc`.\n\nDefault config:\n\n```sh\nexport RUN_NODE_ERROR_MSG=\"Couldn't find the Node.js binary. Ensure you have Node.js installed. Open an issue on https://github.com/sindresorhus/run-node\"\nexport RUN_NODE_CACHE_PATH=\"/home/username/.node_path\"\n```\n\nIf the `RUN_NODE_CACHE_PATH` environment variable is defined explicitly, the script it points to will be sourced before looking for a `node` binary. You can use this script to override your `PATH` variable so that a specific `node` binary is found.\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Mathias Fredriksson](https://github.com/mafredri)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cb\u003e\n\t\t\u003ca href=\"https://tidelift.com/subscription/pkg/npm-run-node?utm_source=npm-run-node\u0026utm_medium=referral\u0026utm_campaign=readme\"\u003eGet professional support for this package with a Tidelift subscription\u003c/a\u003e\n\t\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003csub\u003e\n\t\tTidelift helps make open source sustainable for maintainers while giving companies\u003cbr\u003eassurances about security, maintenance, and licensing for their dependencies.\n\t\u003c/sub\u003e\n\u003c/div\u003e\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate","https://tidelift.com/subscription/pkg/npm-run-node?utm_source=npm-run-node\u0026utm_medium=referral\u0026utm_campaign=readme"],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Frun-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Frun-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Frun-node/lists"}