正如here指出的那样,npm的进度条显着降低了整个安装进度。给出的解决方案是禁用它
$> npm set progress=false && npm install
我遇到的问题是,是否可以在项目中设置某些内容(例如在package.json中),以便我可以在命令行中省略progress=false
,只需执行$> npm install
并获取与上面相同的结果?
答案 0 :(得分:37)
将以下内容添加到项目根文件夹中名为.npmrc
的文件中:
progress=false
也可以将此文件放在您的主目录中:~/.npmrc
您也可以在命令行中执行此操作:
npm install --no-progress
答案 1 :(得分:16)
在npm的更高版本中,您可以使用
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<!--=============================datetimepicker ================-->
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen"
href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">
<!--=============================countdown timer================-->
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>jquery countDownTimer Demo reverse countdown clock</title>
<meta name="description" content="reverse clock plugin for jQuery.">
<meta name="keywords" content="jQuery, plugin, count down">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script type="text/javascript" src="../LIB/jquery-2.0.3.js"></script>
<script type="text/javascript" src="../jquery.countdownTimer.js"></script>
<link rel="stylesheet" type="text/css" href="../CSS/jquery.countdownTimer.css" />
</head>
<body>
<div id="main">
<h3><u>Reverse countdown till a specific future date from today.</u><br/>(for eg:- 2018/01/01 00:00:00)</h3>
<div id="datetimepicker" class="input-append date">
<input type="text" id="date"></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
<div>
<button type='submit' class="btn btn-primary start">Start</button>
</div>
</br>
<table style="border:0px;">
<tr>
<td colspan="8"><span id="future_date"></span></td>
</tr>
</table>
<script>
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery('.start').click(function(){
var date = jQuery("#date").val();
time = date.split(' ')[1];
date = date.split(' ')[0];
var firstDate = {day: date.split('/')[0], hours:time.split(':')[0], minutes: time.split(':')[1], seconds: time.split(':')[2]};
var sDate = new Date();
var secondDate = {day: sDate.getDate(), hours:sDate.getHours(), minutes: sDate.getMinutes(), seconds: sDate.getSeconds()};
var subtime = function(fDate , tDate){
var date = Math.abs(parseInt(fDate.day) - tDate.day);
var hours = Math.abs(parseInt(fDate.hours) - tDate.hours);
var minutes = Math.abs(parseInt(fDate.minutes) - tDate.minutes);
var seconds = Math.abs(parseInt(fDate.seconds) - tDate.seconds);
return {date: date, hours: hours, minutes: minutes, seconds: seconds};
};
var diff = subtime(firstDate, secondDate);
var dateStr = diff.date + " " + diff.hours + ":" + diff.minutes + ":" + diff.seconds;
alert(dateStr);
jQuery('#future_date').countdowntimer({
// dateAndTime : "5 00:00:00"‚
dateAndTime : dateStr‚ // I want dateAndTime dateStr like the above dateAndTime
size : "lg",
});
});
});
</script>
</div>
<script type="text/javascript"
src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js">
</script>
<script type="text/javascript"
src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js">
</script>
<script type="text/javascript"
src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js">
</script>
<script type="text/javascript">
jQuery.noConflict();
jQuery('#datetimepicker').datetimepicker({
format: 'dd/MM/yyyy hh:mm:ss',
language: 'pt-BR'
});
</script>
</body>
</html>
答案 2 :(得分:2)
虽然操作和选择的答案可能运作良好,但我的问题却有所不同: package.json 中的一些构建步骤明确包含在 - progress 中,这只是让我的Jenkins构建缓慢而丑陋。
我在执行npm install之前删除了一个简单的sed:
sed -i 's#--progress##g' package.json
当然,如果我有的写入权限,可能最好直接从sources文件中删除--progress参数。
无论如何,我希望它会有所帮助。