Node.js 和 V8 是什么关系? [英] What is the relationship between Node.js and V8?

查看:71
本文介绍了Node.js 和 V8 是什么关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题我想了很久,似乎找不到答案.Node.js 和 V8 是什么关系?Node.js 可以在没有 V8 的情况下工作吗?

I've been thinking about this question for a while and can't seem to find the answer. What is the relationship between Node.js and V8? and Can Node.js work without V8?

推荐答案

Node.js 和 V8 是什么关系?

What is the relationship between Node.js and V8?

V8 是 node.js 中的 Javascript 引擎,用于解析和运行您的 Javascript.Chrome 内部使用相同的 V8 引擎在 Chrome 浏览器中运行 javascript.Google 开源了 V8 引擎,node.js 的构建者使用它在 node.js 中运行 Javascript.

V8 is the Javascript engine inside of node.js that parses and runs your Javascript. The same V8 engine is used inside of Chrome to run javascript in the Chrome browser. Google open-sourced the V8 engine and the builders of node.js used it to run Javascript in node.js.

Node.js 可以在没有 V8 的情况下工作吗?

Can Node.js work without V8?

没有.当前的 node.js 二进制文件在没有 V8 的情况下无法运行.它将没有 Javascript 引擎,因此无法运行显然会使其无法正常工作的代码.Node.js 并非设计为与任何其他 Javascript 引擎一起运行,事实上,node.js 附带的所有本机代码绑定(例如 fs 模块或 net 模块)都依赖于 C++ 和Javascript.

No. The current node.js binary cannot work without V8. It would have no Javascript engine and thus no ability to run code which would obviously render it non-functional. Node.js was not designed to run with any other Javascript engine and, in fact, all the native code bindings that come with node.js (such as the fs module or the net module) all rely on the specific V8 interface between C++ and Javascript.

Microsoft 努力允许 Chakra Javascript 引擎(即 Edge 中的引擎)与 node.js 一起使用.他们在 Chakra 之上构建了一个 V8 shim,以便期望与 V8 对话的 node.js 二进制代码可以继续做它正在做的事情,但实际上最终会与下面的 Chakra 引擎对话.从我读到的内容来看,这特别针对已经有 Chakra 引擎但没有在其上运行 V8 引擎的 Microsoft 平台,不过大概您也可以在 Windows 上使用它.

There is an effort by Microsoft to allow the Chakra Javascript engine (that's the engine in Edge) to be used with node.js. They build a V8 shim on top of Chakra so that the node.js binary code that expects to be talking to V8 can continue to do what it was doing, but actually end up talking to the Chakra engine underneath. From what I've read this is particularly targeted at Microsoft platforms that already have the Chakra engine and do not have the V8 engine running on them, though presumably you could use it on Windows too.

这篇关于Node.js 和 V8 是什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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