Skip to content

Commit

Permalink
fix(docs): clean up npm start docs
Browse files Browse the repository at this point in the history
Adds an example, and a note about how this differs than node's default
behavior
  • Loading branch information
wraithgar committed Jan 8, 2021
1 parent eb061ca commit e986ace
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
32 changes: 29 additions & 3 deletions docs/content/commands/npm-start.md
Expand Up @@ -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 an predefined command specified in the `"start"` property of
a package's `"scripts"` object.

If no `"start"` property is specified on the `"scripts"` object, it
will run `node server.js`.

Note that this is different than the default node behavior of running
the file specified in a package's `"main"` attribute when evoking with
`node .`

As of [`npm@2.0.0`](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

> npm@x.x.x start
> node foo.js

(server.js output would be here)

```

### See Also

* [npm run-script](/commands/npm-run-script)
Expand Down
1 change: 1 addition & 0 deletions server.js
@@ -0,0 +1 @@
console.log('hi')

0 comments on commit e986ace

Please sign in to comment.