\begin{quote}
Get your \href{https://en.wikipedia.org/wiki/PATH_(variable)}{\texttt{ PATH}} prepended with locally installed binaries \end{quote}
In \href{https://docs.npmjs.com/cli/run-script}{\texttt{ npm run scripts}} you can execute locally installed binaries by name. This enables the same outside npm.\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18731}{}\doxysection{Install}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18731}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/-\/save npm-\/run-\/path }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18732}{}\doxysection{Usage}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18732}

\begin{DoxyCode}{0}
\DoxyCodeLine{const childProcess = require('child\_process');}
\DoxyCodeLine{const npmRunPath = require('npm-\/run-\/path');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(process.env.PATH);}
\DoxyCodeLine{//=> '/usr/local/bin'}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(npmRunPath());}
\DoxyCodeLine{//=> '/Users/sindresorhus/dev/foo/node\_modules/.bin:/Users/sindresorhus/dev/node\_modules/.bin:/Users/sindresorhus/node\_modules/.bin:/Users/node\_modules/.bin:/node\_modules/.bin:/usr/local/bin'}
\DoxyCodeLine{}
\DoxyCodeLine{// `foo` is a locally installed binary}
\DoxyCodeLine{childProcess.execFileSync('foo', \{}
\DoxyCodeLine{    env: npmRunPath.env()}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18733}{}\doxysection{API}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18733}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18734}{}\doxysubsection{npm\+Run\+Path(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18734}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18735}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18735}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18736}{}\doxyparagraph{cwd}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18736}
Type\+: {\ttfamily string}~\newline
 Default\+: {\ttfamily process.\+cwd()}

Working directory.\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18737}{}\doxyparagraph{path}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18737}
Type\+: {\ttfamily string}~\newline
 Default\+: \href{https://github.com/sindresorhus/path-key}{\texttt{ {\ttfamily PATH}}}

PATH to be appended.~\newline
 Set it to an empty string to exclude the default PATH.\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18738}{}\doxysubsection{npm\+Run\+Path.\+env(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18738}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18739}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18739}
\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18740}{}\doxyparagraph{cwd}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18740}
Type\+: {\ttfamily string}~\newline
 Default\+: {\ttfamily process.\+cwd()}

Working directory.\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18741}{}\doxyparagraph{env}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18741}
Type\+: {\ttfamily Object}

Accepts an object of environment variables, like {\ttfamily process.\+env}, and modifies the PATH using the correct \href{https://github.com/sindresorhus/path-key}{\texttt{ PATH key}}. Use this if you\textquotesingle{}re modifying the PATH for use in the {\ttfamily child\+\_\+process} options.\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18742}{}\doxysection{Related}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18742}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/npm-run-path-cli}{\texttt{ npm-\/run-\/path-\/cli}} -\/ CLI for this module
\item \href{https://github.com/sindresorhus/execa}{\texttt{ execa}} -\/ Execute a locally installed binary
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18743}{}\doxysection{License}\label{md_sfcode_node_modules_npm_run_path_readme_autotoc_md18743}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 