這會重新啟動專案。等同於執行 npm run-script restart
。
如果目前的專案在 package.json
中指定了 "restart"
指令碼,則會執行下列指令碼
- prerestart
- restart
- postrestart
如果它沒有指定 "restart"
指令碼,但有 stop
和/或 start
指令碼,則會執行下列指令碼
- prerestart
- prestop
- stop
- poststop
- prestart
- start
- poststart
- postrestart
如果為 true,npm 就不會執行在 package.json 檔案中指定的指令碼。
請注意,明確用於執行特定指令碼的指令,例如 npm start
、npm stop
、npm restart
、npm test
和 npm run-script
,如果設定了 ignore-scripts
,仍會執行其預期的指令碼,但不會執行任何前置或後置指令碼。
- 預設值:POSIX 系統上的 '/bin/sh',Windows 上的 'cmd.exe'
- 類型:null 或字串
用於執行 npm exec
、npm run
和 npm init <package-spec>
指令的指令碼殼層。