问题描述
我看到了以下包含-s
选项的命令. (-s
)是什么意思?因为我没有在package.json
中看到该选项.
I saw the following command that includes -s
option. What does it(-s
) mean? Because I didn't see the option in package.json
.
$ npm run dev -s
推荐答案
标志-s
表示沉默",并应用于npm
,而不应用于dev
脚本中的命令.
The flag -s
stands for "silent" and is applied to npm
, not to the command in the dev
script.
当命令以非零状态退出时(即命令失败),-s
标志可防止npm
向您尖叫.它还不会创建npm_debug.log文件.
The -s
flag prevents npm
from screaming at you when the command exits with a non-zero status, i.e. when the command fails. It also won't create an npm_debug.log file.
要自己测试差异,可以在新目录中执行以下操作.
To test out the difference yourself you can do the following in a new directory.
npm init -y
npm run test
npm run test -s
注2:要将-s
标志传递给dev
脚本,应运行npm run dev -- -s
.
Note 2: To pass the -s
flag to the dev
script, you would run npm run dev -- -s
.
这篇关于-s在npm命令中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!