Skip to content

Commit d5d2736

Browse files
committed
fix(docs): clean up npm start docs
Adds an example, and a note about how this differs than node's default behavior
1 parent eb061ca commit d5d2736

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

docs/content/commands/npm-start.md

Lines changed: 29 additions & 3 deletions
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 an predefined command specified in the `"start"` property of
16+
a package's `"scripts"` object.
17+
18+
If no `"start"` property is specified on the `"scripts"` object, it
19+
will run `node server.js`.
20+
21+
Note that this is different than 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 [`[email protected]`](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+
42+
> node foo.js
43+
44+
(server.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)