1 .TH "NPM\-RUN\-SCRIPT" "1" "October 2016" "" ""
3 \fBnpm-run-script\fR \- Run arbitrary package scripts
8 npm run\-script [command] [\-\- <args>]
9 npm run [command] [\-\- <args>]
14 This runs an arbitrary command from a package's \fB"scripts"\fP object\. If no
15 \fB"command"\fP is provided, it will list the available scripts\. \fBrun[\-script]\fP is
16 used by the test, start, restart, and stop commands, but can be called
17 directly, as well\. When the scripts in the package are printed out, they're
18 separated into lifecycle (test, start, restart) and directly\-run scripts\.
20 As of \fBnpm@2\.0\.0\fP \fIhttp://blog\.npmjs\.org/post/98131109725/npm\-2\-0\-0\fR, you can
21 use custom arguments when executing scripts\. The special option \fB\-\-\fP is used by
22 getopt \fIhttp://goo\.gl/KxMmtG\fR to delimit the end of the options\. npm will pass
23 all the arguments after the \fB\-\-\fP directly to your script:
27 npm run test \-\- \-\-grep="pattern"
31 The arguments will only be passed to the script specified after \fBnpm run\fP
32 and not to any pre or post script\.
34 The \fBenv\fP script is a special built\-in command that can be used to list
35 environment variables that will be available to the script at runtime\. If an
36 "env" command is defined in your package it will take precedence over the
39 In addition to the shell's pre\-existing \fBPATH\fP, \fBnpm run\fP adds
40 \fBnode_modules/\.bin\fP to the \fBPATH\fP provided to scripts\. Any binaries provided by
41 locally\-installed dependencies can be used without the \fBnode_modules/\.bin\fP
42 prefix\. For example, if there is a \fBdevDependency\fP on \fBtap\fP in your package,
47 "scripts": {"test": "tap test/\\*\.js"}
51 instead of \fB"scripts": {"test": "node_modules/\.bin/tap test/\\*\.js"}\fP to run your tests\.