Skip to content

Commit 7dd0dfc

Browse files
committedJan 14, 2021
fix(docs): clean up npm start docs
Adds an example, and a note about how this differs than node's default behavior PR-URL: #2459 Credit: @wraithgar Close: #2459 Reviewed-by: @darcyclarke
1 parent eb061ca commit 7dd0dfc

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed
 

‎docs/content/commands/npm-start.md

+29-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,39 @@ npm start [-- <args>]
1212

1313
### Description
1414

15-
This runs an arbitrary command specified in the package's `"start"` property of
16-
its `"scripts"` object. If no `"start"` property is specified on the
17-
`"scripts"` object, it will run `node server.js`.
15+
This runs a predefined command specified in the `"start"` property of
16+
a package's `"scripts"` object.
17+
18+
If the `"scripts"` object does not define a `"start"` property, npm
19+
will run `node server.js`.
20+
21+
Note that this is different from the default node behavior of running
22+
the file specified in a package's `"main"` attribute when evoking with
23+
`node .`
1824

1925
As of [`npm@2.0.0`](https://blog.npmjs.org/post/98131109725/npm-2-0-0), you can
2026
use custom arguments when executing scripts. Refer to [`npm run-script`](/commands/npm-run-script) for more details.
2127

28+
### Example
29+
30+
```json
31+
{
32+
"scripts": {
33+
"start": "node foo.js"
34+
}
35+
}
36+
```
37+
38+
```bash
39+
npm start
40+
41+
> npm@x.x.x start
42+
> node foo.js
43+
44+
(foo.js output would be here)
45+
46+
```
47+
2248
### See Also
2349

2450
* [npm run-script](/commands/npm-run-script)

0 commit comments

Comments
 (0)