最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Console.log not displaying any output (NodeJs) - Stack Overflow

programmeradmin1浏览0评论

I am trying to console log a piece of JavaScript code through Node.Js but the terminal is not showing any output.

const pokemon = require('pokemon');
pokemon.all();
var name = pokemon.random();
console.log(name);

Can't even console log a simple line of code

console.log("Hello");

Image of terminal after executing node file

I am trying to console log a piece of JavaScript code through Node.Js but the terminal is not showing any output.

const pokemon = require('pokemon');
pokemon.all();
var name = pokemon.random();
console.log(name);

Can't even console log a simple line of code

console.log("Hello");

Image of terminal after executing node file

Share Improve this question edited May 9, 2020 at 5:36 h3t1 1,2462 gold badges19 silver badges32 bronze badges asked May 9, 2020 at 3:26 Prabhnoor SinghPrabhnoor Singh 591 silver badge2 bronze badges 1
  • 1 post the plete code of file – Lint Commented May 9, 2020 at 3:39
Add a ment  | 

2 Answers 2

Reset to default 3

It is possible that you use node which is not a nodejs package but another. If you type node on mand line, do you see something like this? Especially the message Wele to Node.js vxx.xx.x.

hanania@laptop:~$ node
Wele to Node.js v12.16.3.
Type ".help" for more information.
>

just try to check out if nodejs is installed successfully on your device by runing

node --version

and if it doesn't respond with nodejs version you need to reinstall nodejs

发布评论

评论列表(0)

  1. 暂无评论