简体   繁体   English

如何禁用npm的进度条

[英]How to disable npm's progress bar

As pointed out here the progress bar of npm slows down the whole installation progress significantly. 正如这里指出的那样,npm的进度条显着降低了整个安装进度。 The solution given is to disable it 给出的解决方案是禁用它

$> npm set progress=false && npm install

The question I have, is it possible inside a project to set something (in package.json for example) such that I can omit progress=false on the command line and simply can do $> npm install and obtain the same result as above? 我的问题是,在项目中可以设置一些内容(例如在package.json中),这样我可以在命令行中省略progress=false并且只需要执行$> npm install并获得与上面相同的结果吗?

Add the following to a file called .npmrc in your project root folder: 将以下内容添加到项目根文件夹中名为.npmrc文件中:

progress=false

It is also possible to place this file in your home directory: ~/.npmrc 也可以将此文件放在主目录中: ~/.npmrc

Learn more about NPM config. 了解有关NPM配置的更多信息。

You can also do this on the command line: 您也可以在命令行上执行此操作:

npm install --no-progress

in the later version of npm you can use 在npm的更高版本中,您可以使用

npm install --no-progress

see https://docs.npmjs.com/misc/config#progress 请参阅https://docs.npmjs.com/misc/config#progress

While the op's and selected answer probably work well, my issue was different : some build steps in package.json explicitely included --progress , which was just making my Jenkins builds slow and ugly. 虽然操作和选择的答案可能运行良好,但我的问题有所不同: package.json中的一些构建步骤明确包含--progress ,这只是让我的Jenkins构建缓慢而丑陋。

I removed those with a simple sed before executing npm install : 在执行npm install之前,我用一个简单的sed删除了那些:
sed -i 's#--progress##g' package.json

Of course, if I had had write access to , it might have been better to remove the --progress argument directly from the sources files. 当然,如果我不得不写访问 ,它可能已经不如直接从源文件中删除--progress参数。


Anyway, I hope it will help. 无论如何,我希望它会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM