[英]Console.log not displaying any output (NodeJs)
I am trying to console log a piece of JavaScript code through Node.Js but the terminal is not showing any output.我正在尝试通过 Node.Js 控制台记录一段 JavaScript 代码,但终端未显示任何 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");
It is possible that you use node which is not a nodejs package but another.您可能使用的节点不是 nodejs package 而是另一个。 If you type
node
on command line, do you see something like this?如果你在命令行输入
node
,你会看到这样的东西吗? Especially the message Welcome to Node.js vxx.xx.x.
特别是
Welcome to Node.js vxx.xx.x.
的消息。
hanania@laptop:~$ node
Welcome 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只需尝试通过运行检查 nodejs 是否已成功安装在您的设备上
node --version
and if it doesn't respond with nodejs version you need to reinstall nodejs如果它没有响应 nodejs 版本,您需要重新安装 nodejs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.