@reggi/path-to-regexp
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-restart |
| 3 | section: 1 |
| 4 | description: Restart a package |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v7 |
| 7 | github_path: docs/content/commands/npm-restart.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v7/cli-commands/npm-restart |
| 10 | - /cli-documentation/v7/cli-commands/restart |
| 11 | - /cli-documentation/v7/commands/npm-restart |
| 12 | - /cli-documentation/v7/commands/restart |
| 13 | - /cli-documentation/v7/npm-restart |
| 14 | - /cli-documentation/v7/restart |
| 15 | - /cli/v7/cli-commands/npm-restart |
| 16 | - /cli/v7/cli-commands/restart |
| 17 | - /cli/v7/commands/restart |
| 18 | - /cli/v7/npm-restart |
| 19 | - /cli/v7/restart |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm restart [-- <args>] |
| 26 | ``` |
| 27 | |
| 28 | ### Description |
| 29 | |
| 30 | This restarts a project. It is equivalent to running `npm run-script restart`. |
| 31 | |
| 32 | If the current project has a `"restart"` script specified in `package.json`, then the following scripts will be run: |
| 33 | |
| 34 | 1. prerestart |
| 35 | 2. restart |
| 36 | 3. postrestart |
| 37 | |
| 38 | 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: |
| 39 | |
| 40 | 1. prerestart |
| 41 | 2. prestop |
| 42 | 3. stop |
| 43 | 4. poststop |
| 44 | 5. prestart |
| 45 | 6. start |
| 46 | 7. poststart |
| 47 | 8. postrestart |
| 48 | |
| 49 | ### Configuration |
| 50 | |
| 51 | #### `ignore-scripts` |
| 52 | |
| 53 | - Default: false |
| 54 | - Type: Boolean |
| 55 | |
| 56 | If true, npm does not run scripts specified in package.json files. |
| 57 | |
| 58 | 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. |
| 59 | |
| 60 | #### `script-shell` |
| 61 | |
| 62 | - Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows |
| 63 | - Type: null or String |
| 64 | |
| 65 | The shell to use for scripts run with the `npm exec`, `npm run` and `npm init <pkg>` commands. |
| 66 | |
| 67 | ### See Also |
| 68 | |
| 69 | - [npm run-script](/cli/v7/commands/npm-run-script) |
| 70 | - [npm scripts](/cli/v7/using-npm/scripts) |
| 71 | - [npm test](/cli/v7/commands/npm-test) |
| 72 | - [npm start](/cli/v7/commands/npm-start) |
| 73 | - [npm stop](/cli/v7/commands/npm-stop) |
| 74 | - [npm restart](/cli/v7/commands/npm-restart) |