我在哪里可以找到 node.js 解释器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36038616/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 20:03:19  来源:igfitidea点击:

Where can I find node.js interpreter

node.jswebstorm

提问by Breaker222

In WebStorm to get karma.confrunning I need to configure it in a pop up window and enter the "path to the node.js interpreter".

在 WebStorm 中karma.conf运行我需要在弹出窗口中配置它并输入“node.js 解释器的路径”。

(for some reason this information vanished after a restart)

(出于某种原因,此信息在重新启动后消失了)

Questions:

问题:

  1. What is the path to the needed file?
  2. Where is the node interpreter on Mac/Linux/Windows by default?
  1. 所需文件的路径是什么?
  2. Mac/Linux/Windows 上的节点解释器默认在哪里?

(I am on OS X)

(我在 OS X 上)

回答by B0dz1o

Generally, on OSX and Linux, you can find any program with which program. In your case, type

通常,在 OSX 和 Linux 上,您可以找到任何带有which program. 在你的情况下,输入

which node

in terminal.

在终端。

回答by Timothy Mugayi

On windows command prompt

在 Windows 命令提示符下

where node

回答by grail

On OSX if you've installed Node.js with brew:

在 OSX 上,如果你用 brew 安装了 Node.js:

/usr/local/bin/node

/usr/local/bin/node

You can check the exact folder on your machine with the command which node

您可以使用以下命令检查机器上的确切文件夹 which node

Important

重要的

When the finder opens on OSX, you won't be able to navigate to this path initially. You'll first need to navigate to the root folder e.g. Macintosh HDand then perform the keyboard shortcut Command + Shift + .(. = dot = period) to be able to select hidden files and folders.

当 finder 在 OSX 上打开时,您最初将无法导航到此路径。您首先需要导航到根文件夹,例如Macintosh HD,然后执行键盘快捷键Command + Shift + .(. = 点 = 句点)才能选择隐藏的文件和文件夹。

enter image description here

在此处输入图片说明

回答by Jonathan D'Orleans

Ubuntu:

Ubuntu:

sudo apt install nodejs

whereis nodejs

nodejs: /usr/bin/nodejs /usr/lib/nodejs /usr/include/nodejs /usr/share/nodejs /usr/share/man/man1/nodejs.1.gz

Configuring NodeJS Intepreter in IntelliJ:

在 IntelliJ 中配置 NodeJS 解释器:

File | Settings | Languages & Frameworks | Node.js and NPM
Node interpreter: Add... (select from the above path or add it)
/usr/bin/nodejs

Then, click on Enablebutton and select the modules.

然后,单击Enable按钮并选择模块。

回答by Breaker222

On OSX: /usr/local/bin/node

在 OSX 上: /usr/local/bin/node

well I got it by myself, but wanted to share the answer, as I couldn't find it on google / stack overflow and hope to save somebody some time

好吧,我自己得到了它,但想分享答案,因为我在 google/stack overflow 上找不到它,希望能节省一些时间

回答by Breaker222

This can be useful for someone. I tried all the previous methods on Linux Ubuntu 19.10, none worked, neither reinstalling nodejs. So I installed Webstorm via snap, with:

这可能对某人有用。我在 Linux Ubuntu 19.10 上尝试了之前的所有方法,都没有奏效,也没有重新安装 nodejs。所以我通过 snap 安装了 Webstorm,使用:

sudo snap install webstorm
sudo snap install webstorm --classic

And surprise, Nodejs was already configured in this version. Then I erased the webstorm version that I installed from Ubuntu Softwared. That worked for me and was easy. Hope that can give you a clue.

令人惊讶的是,这个版本中已经配置了 Nodejs。然后我删除了我从 Ubuntu Softwared 安装的 webstorm 版本。这对我有用而且很容易。希望能给你一个线索。