-s在npm命令中是什么意思? [英] What does -s mean in npm command?

查看:905
本文介绍了-s在npm命令中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了以下包含-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

注1:我更喜欢写npm run -s dev来限制可能出现的混乱.

Note 1: I prefer to write npm run -s dev to limit possible confusion.

注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命令中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆