-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds an example, and a note about how this differs than node's default behavior
- Loading branch information
Showing
1 changed file
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,39 @@ npm start [-- <args>] | |
|
||
### Description | ||
|
||
This runs an arbitrary command specified in the package's `"start"` property of | ||
its `"scripts"` object. If no `"start"` property is specified on the | ||
`"scripts"` object, it will run `node server.js`. | ||
This runs a predefined command specified in the `"start"` property of | ||
a package's `"scripts"` object. | ||
|
||
If the `"scripts"` object does not define a `"start"` property, npm | ||
will run `node server.js`. | ||
|
||
Note that this is different from the default node behavior of running | ||
the file specified in a package's `"main"` attribute when evoking with | ||
`node .` | ||
|
||
As of [`[email protected]`](https://blog.npmjs.org/post/98131109725/npm-2-0-0), you can | ||
use custom arguments when executing scripts. Refer to [`npm run-script`](/commands/npm-run-script) for more details. | ||
|
||
### Example | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"start": "node foo.js" | ||
} | ||
} | ||
``` | ||
|
||
```bash | ||
npm start | ||
|
||
> [email protected] start | ||
> node foo.js | ||
|
||
(foo.js output would be here) | ||
|
||
``` | ||
|
||
### See Also | ||
|
||
* [npm run-script](/commands/npm-run-script) | ||
|