I am using console.table in my program, test.js to display data but with no luck.
require('console.table');
var values = [
['max', 20],
['joe', 30]
];
console.table(['name', 'age'], values);
And when I run this app I get nothing on the screen
$ node test.js
$
I have already installed console.table
$ npm install --save console.table
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
updated 1 package in 0.687s
$ node test.js
$
I am using Ubuntu 16.04, kindly advice.
I am using console.table in my program, test.js to display data but with no luck.
require('console.table');
var values = [
['max', 20],
['joe', 30]
];
console.table(['name', 'age'], values);
And when I run this app I get nothing on the screen
$ node test.js
$
I have already installed console.table
$ npm install --save console.table
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
updated 1 package in 0.687s
$ node test.js
$
I am using Ubuntu 16.04, kindly advice.
Share Improve this question edited Jul 23, 2017 at 8:47 Joel Divekar asked Jul 23, 2017 at 7:17 Joel DivekarJoel Divekar 1871 gold badge6 silver badges22 bronze badges 1- Can you tell me the node version? – Himanshu sharma Commented Jul 23, 2017 at 10:47
3 Answers
Reset to default 5Have you install console.table package or not.
If you didn't install then first install using
npm install --save console.table
Try this
require('console.table')
var values = [
['max', 20],
['joe', 30]
];
console.table(values);
This is my output
I am trying your script as well and I am getting result
Well for upper version of node.js you need not to install console.table
if still you install you have to use console.table like as follows.
delete console.table;
require('console.table');
or
require('console.table')({force: true})
This issue is not of console.table . Actually console.table does not work on version node 7+
version node 6.11
the output is this
and in version node 8.0
the output is
I have used a frame work called columnify - npm install columnify
const columnify = require('columnify');
//Connect to datbase (mypany) collection
db.collection('employee').find({}, {projection:{_id: 0}}).toArray((err, allRecords) => {
//Error checking
if (err) {
console.log('Error encontered!!!');
} else {
console.log(columnify(allRecords));
process.exit(0);
};
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745301378a4621455.html
评论列表(0条)