如何去掉“警告:这是一项实验性功能,可能随时更改”消息

Dem*_*rvO 8 node.js npm visual-studio-code

基本上,我遵循了 VSCode: Is it possible to subpressexperimentaldecorator warnings以便取出此类消息,但没有产生任何效果。

首先,我收到这样的消息:

“(节点:15077)DeprecationWarning:node --debug 已弃用。请改用node --inspect”。我在某处读到在 launch.json 中添加 "protocol": "auto" (老实说,我不知道我设置了什么自动)。

它更改了本主题中提到的警告。好吧,我已将 jsconfig.json 添加到项目根目录,但似乎没有改变任何内容。

我不知道它是否相关,但我注意到 Visual Studio Code About 指向 Node 6.5.0,而我的本地节点是 7.7.4。

最后但并非最不重要的一点是,这样的警告意味着什么?

启动.json

{
    // Use IntelliSense to learn about possible Node.js debug attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/server.js",
            "protocol": "auto"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Process",
            "address": "localhost",
            "port": 5858
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

jsconfig.json

{
    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "module": "amd",
        "target": "ES6" 
    },
    "files": []
}
Run Code Online (Sandbox Code Playgroud)

Debian外壳

demetrio@nodejs ~/tool/elasticsearch-head $ node -v
v7.7.4
Run Code Online (Sandbox Code Playgroud)

Visual Studio 代码关于:

Version 1.10.2
Commit 8076a19fdcab7e1fc1707952d652f0bb6c6db331
Date 2017-03-08T14:00:46.854Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0
Run Code Online (Sandbox Code Playgroud)

jes*_*ess -2

在启动配置中设置协议是告诉 Visual Studio Code 使用哪个调试器。可以使用以下方式指定原始调试器:

'protocol': 'legacy'

可以使用以下方式指定较新的调试器:

'protocol': 'inspector'

最后是选项:

'protocol': 'auto'

允许 Visual Studio 代码决定使用哪个调试器。看起来在 2 月份发布的代码 (1.10) 中,它使用了较新的节点版本 >=6.9。对于 3 月份发布的代码 (1.11),它仅对节点版本 8.x 使用较新的代码。

有关两种不同调试器的更多信息,请参阅以下链接:

2 月 1.10 版

3 月 1.11 发布

导致此消息的是较新的调试器。要么指定您想要旧版调试器,要么将代码升级到版本 1.11(并使用节点 < v8)将其删除。