run-node

WebJar for run-node

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

run-node
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

run-node
WebJar for run-node
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/run-node

Download run-node

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/run-node/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>run-node</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/run-node/
implementation 'org.webjars.npm:run-node:0.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/run-node/
implementation ("org.webjars.npm:run-node:0.2.0")
'org.webjars.npm:run-node:jar:0.2.0'
<dependency org="org.webjars.npm" name="run-node" rev="0.2.0">
  <artifact name="run-node" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='run-node', version='0.2.0')
)
libraryDependencies += "org.webjars.npm" % "run-node" % "0.2.0"
[org.webjars.npm/run-node "0.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

run-node Build Status

Run the Node.js binary no matter what

You 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, 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... I prefer things to just work. With this module it will.

This Bash script uses some tricks to find the Node.js binary on your system and run it.

Can be used from any environment that can spawn a process (Shell, Python, Ruby, Swift, Objective-C, etc).

npm

Install

$ npm install run-node

Usage

$ ./node_modules/.bin/run-node file.js

Or in an npm run script:

{
	"start": "run-node file.js"
}

If the node package is found in the local node_modules directory (for instance, if you have it installed as a devDependency of your npm project), this is the node binary that will be used.

Manually

Install

Download the run-node file:

$ curl -sSLO https://github.com/sindresorhus/run-node/raw/master/run-node && chmod +x run-node

Usage

./run-node file.js

Customizable cache path and error message

The 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.

Default config:

export 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"
export RUN_NODE_CACHE_PATH="/home/username/.node_path"

If 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.

Maintainers


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
0.2.0