npm-restart

重启一个包

选择命令行版本:

概要

¥Synopsis

npm restart [-- <args>]

描述

¥Description

这将重新启动一个项目。相当于运行 npm run-script restart

¥This restarts a project. It is equivalent to running npm run-script restart.

如果当前项目在 package.json 中指定了 "restart" 脚本,则将运行以下脚本:

¥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

如果它没有指定 "restart" 脚本,但它确实有 stop 和/或 start 脚本,则将运行以下脚本:

¥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:

  1. prerestart
  2. prestop
  3. stop
  4. poststop
  5. prestart
  6. start
  7. poststart
  8. postrestart

配置

¥Configuration

ignore-scripts

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

如果为 true,npm 不会运行 package.json 文件中指定的脚本。

¥If true, npm does not run scripts specified in package.json files.

请注意,如果设置了 ignore-scripts,则明确旨在运行特定脚本的命令(例如 npm startnpm stopnpm restartnpm testnpm run-script)仍将运行其预期的脚本,但它们不会运行任何前置或后置脚本。

¥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.

script-shell

  • 默认值:'/bin/sh' 在 POSIX 系统上,'cmd.exe' 在 Windows 上

    ¥Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows

  • 类型:空值或字符串

    ¥Type: null or String

用于脚本的 shell 与 npm execnpm runnpm init <package-spec> 命令一起运行。

¥The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

也可以看看

¥See Also

npm 中文网 - 粤ICP备13048890号