如何使用 vscode 中的自定义参数启动 nodejs [英] How to start nodejs with custom params from vscode

查看:79
本文介绍了如何使用 vscode 中的自定义参数启动 nodejs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用额外的命令行参数启动 nodeJS?

Is there any way to start nodeJS with additional command line parameters?

喜欢:

--harmony_generators
--harmony_arrow_functions

--harmony_generators
--harmony_arrow_functions

更新:

暂时的解决方法:

  1. 创建 .bat (windows) 文件:

  1. create .bat (windows) file with:

  • {{path-to-node}}\node.exe --harmony_generators --harmony_arrow_functions %*
  • {{path-to-node}}\node.exe --harmony_generators --harmony_arrow_functions %*

.\settings\launch.json

利润:)

推荐答案

在 VSCode 的预览版中,尚不能将参数从 launch.json 传递给 node.但是上面提到的解决方法工作正常.我在我们这边创建了一个错误,并将确保在下一个版本中修复它.

In the preview version of VSCode it is not yet possible to pass arguments to node from the launch.json. But the workaround mentioned above works fine. I have created a bug on our side and will make sure it’s fixed with the next release.

安德烈·韦南德,可视化工作室代码

Andre Weinand, Visual Studio Code

更新:

修复在 VSCode 中,因为 v0.3 在 .settings/launch.json 中:

The fix is in VSCode since v0.3 with this in .settings/launch.json:

"configurations": [
    {
        ...

        // Optional arguments passed to the runtime executable.
        "runtimeArgs": [],

        ...

所以例如运行支持 ES6 的 Node.js (v0.12) 使用 "runtimeArgs": ["--harmony"],

So to e.g. run Node.js (v0.12) with ES6 support use "runtimeArgs": ["--harmony"],

这篇关于如何使用 vscode 中的自定义参数启动 nodejs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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