Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-run-path

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-run-path

Get your PATH prepended with locally installed binaries

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
72M
increased by7.49%
Maintainers
1
Weekly downloads
 
Created

What is npm-run-path?

The npm-run-path package is used to enhance the PATH environment variable with all the node_modules/.bin directories from the current directory up to the root. This allows you to run locally installed executables in your npm scripts without having to specify the full path to them.

What are npm-run-path's main functionalities?

Enhance PATH for local binaries

This feature allows you to get an enhanced PATH that includes paths to the locally installed npm binaries, making it easier to run them in scripts.

const npmRunPath = require('npm-run-path');

console.log(npmRunPath()); // Logs the enhanced PATH string

Get an environment object with an enhanced PATH

This feature provides an environment object similar to process.env but with the PATH property modified to include local binaries.

const npmRunPath = require('npm-run-path');

const env = npmRunPath.env();
console.log(env.PATH); // Logs the enhanced PATH within the environment object

Customize the PATH enhancement

This feature allows you to customize how the PATH is enhanced by providing options such as the current working directory and an existing PATH to modify.

const npmRunPath = require('npm-run-path');

const options = { cwd: '/some/path', path: process.env.PATH };
const env = npmRunPath.env(options);
console.log(env.PATH); // Logs the enhanced PATH based on the options provided

Other packages similar to npm-run-path

Keywords

FAQs

Package last updated on 26 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc