终端中node vs nodejs命令有什么区别? [英] What is the difference between node vs nodejs command in terminal?

查看:250
本文介绍了终端中node vs nodejs命令有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从nodejs.org上给出的tar文件中解压缩了node.js,但是当我尝试通过node命令执行我的js程序时没有任何反应,但另一方面nodejs命令运行会执行该文件。

I have untarred node.js from the tar file given on nodejs.org, but when i try executing my js program through node command nothing happens, but on the other hand nodejs command runs executes the file.

所以我的问题是node命令和nodejs命令之间的区别是什么?它会影响我的程序,因为我没有从源代码构建这就是造成这种差异的原因。

So my question is what's the difference between node command and nodejs command as and will it effect my programs as i didn't build from the source code. And i of that is the reason of this discrepancy.

推荐答案

这在很大程度上取决于很多因素。主要是,它取决于你的shell实际上是什么节点 nodejs 。你可以使用类型节点 / 类型nodejs 和/或检查这个节点 / 哪个nodejs (或者 whereis )。这个取决于操作系统和shell。

This is highly dependent on many factors. Mainly, it depends on what node and nodejs in your shell actually are. You can check this using type node / type nodejs and/or which node / which nodejs (or perhaps whereis). This also depends on the OS and the shell.

我的猜测是哪个-a节点将产生 / usr / sbin / node 这是 nodejs可执行文件,因此它不会执行您的节点代码。在我的系统上,它是:

My guess is that which -a node will yield /usr/sbin/node which is not the nodejs executable and thus why it does not execute your node code. On my system, it is:

/usr/bin/node -> /etc/alternatives/node -> /usr/bin/nodejs

即。 node 只是 nodejs 的符号链接,这是可执行文件。

i.e. node is just a symbolic link to nodejs, which is the executable.

您也可以自己创建这个别名,以便它覆盖节点适合您。

You can also create this alias yourself so that it overrides whatever node is for you.

这篇关于终端中node vs nodejs命令有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆