【问题标题】:How to configure Visual Studio Code to work with Node.js如何配置 Visual Studio Code 以使用 Node.js
【发布时间】:2015-10-19 00:10:07
【问题描述】:

我有 Visual Studio Code,我用它来编写我的 Node.js 应用程序。在教程中,我看到 Visual Studio Code 具有 IntelliSense 和其他与 Node.js 相关的调试工具,但我在编写应用程序时没有找到它,所以有任何扩展,或者如何配置它以与 Node.js 一起使用?

这是我第一次提出关于配置不写代码的问题,请耐心等待。

【问题讨论】:

    标签: node.js intellisense visual-studio-code


    【解决方案1】:

    您需要为 Visual Studio 安装插件。

    您可以在此处找到更多相关信息: https://github.com/Microsoft/nodejstools#readme

    【讨论】:

    • 这适用于 Visual Studio 和 Visual Studio 代码吗??
    • 似乎适用于 Visual Studio,但它是开源且免费的。可能值得试一试。
    【解决方案2】:

    我的项目的工作配置${workspaceRoot}/.vscode/launch.json:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch",
                "type": "node",
                "request": "launch",
                "program": "${workspaceRoot}/test-script.js",
                "stopOnEntry": false,
                "args": [],
                "cwd": "${workspaceRoot}",
                "preLaunchTask": null,
                "runtimeExecutable": null,
                "runtimeArgs": [
                    "--nolazy"
                ],
                "env": {
                    "PROFILE": "development"
                },
                "externalConsole": false,
                "sourceMaps": false,
                "outDir": null
            },
            {
                "name": "Attach",
                "type": "node",
                "request": "attach",
                "port": 5858,
                "address": "localhost",
                "restart": false,
                "sourceMaps": false,
                "outDir": null,
                "localRoot": "${workspaceRoot}",
                "remoteRoot": null
            },
            {
                "name": "Attach to Process",
                "type": "node",
                "request": "attach",
                "processId": "${command.PickProcess}",
                "port": 5858,
                "sourceMaps": false,
                "outDir": null
            }
        ]
    }
    

    NodeJS 在%Path%:

    >node -v
    v6.7.0
    

    【讨论】:

      猜你喜欢
      • 2021-11-08
      • 2016-08-31
      • 2023-01-17
      • 1970-01-01
      • 2017-02-02
      • 2022-11-26
      • 2017-05-25
      • 2018-06-05
      • 2020-10-19
      相关资源
      最近更新 更多