2019-11-05 14:55:08 -05:00
|
|
|
---
|
|
|
|
title: npm-restart
|
2020-11-01 07:54:36 +01:00
|
|
|
section: 1
|
2019-11-05 14:55:08 -05:00
|
|
|
description: Restart a package
|
|
|
|
---
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Synopsis
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm restart [-- <args>]
|
|
|
|
```
|
|
|
|
|
|
|
|
### Description
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2020-12-11 18:54:56 -05:00
|
|
|
This restarts a project. It is equivalent to running `npm run-script
|
|
|
|
restart`.
|
2015-01-08 14:37:26 -08:00
|
|
|
|
2020-12-11 18:54:56 -05:00
|
|
|
If the current project has a `"restart"` script specified in
|
|
|
|
`package.json`, then the following scripts will be run:
|
|
|
|
|
|
|
|
1. prerestart
|
|
|
|
2. restart
|
|
|
|
3. postrestart
|
|
|
|
|
|
|
|
If it does _not_ have a `"restart"` script specified, but it does have
|
|
|
|
`stop` and/or `start` scripts, then the following scripts will be run:
|
2015-01-08 14:37:26 -08:00
|
|
|
|
|
|
|
1. prerestart
|
|
|
|
2. prestop
|
|
|
|
3. stop
|
|
|
|
4. poststop
|
|
|
|
6. prestart
|
|
|
|
7. start
|
|
|
|
8. poststart
|
|
|
|
9. postrestart
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
### Configuration
|
|
|
|
|
|
|
|
#### `ignore-scripts`
|
|
|
|
|
|
|
|
* Default: false
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
If true, npm does not run scripts specified in package.json files.
|
|
|
|
|
|
|
|
Note that commands explicitly intended to run a particular script, such as
|
|
|
|
`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script`
|
|
|
|
will still run their intended script if `ignore-scripts` is set, but they
|
|
|
|
will *not* run any pre- or post-scripts.
|
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
#### `script-shell`
|
|
|
|
|
|
|
|
* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
|
|
|
|
* Type: null or String
|
|
|
|
|
|
|
|
The shell to use for scripts run with the `npm exec`, `npm run` and `npm
|
2022-06-24 18:21:50 -07:00
|
|
|
init <package-spec>` commands.
|
2021-05-20 15:54:50 -04:00
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### See Also
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm run-script](/commands/npm-run-script)
|
2019-11-18 21:01:39 +02:00
|
|
|
* [npm scripts](/using-npm/scripts)
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm test](/commands/npm-test)
|
|
|
|
* [npm start](/commands/npm-start)
|
|
|
|
* [npm stop](/commands/npm-stop)
|
|
|
|
* [npm restart](/commands/npm-restart)
|