node.js - 如何取出 "Warning: This is an experimental feature and could change at any time"消息

标签 node.js npm visual-studio-code

基本上我已经关注了 VSCode: Is it possible to supress experimental decorator warnings为了取出这样的消息但没有产生任何效果。

首先,我收到此消息:

"(node:15077) DeprecationWarning: node --debug is deprecated. Please use node --inspect instead". I read somewhere to add "protocol": "auto" in launch.json (honestly, I have no idea what I have setup to automatic).

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

我不知道这是否相关,但我注意到 Visual Studio Code About 指向 Node 6.5.0,而我的本地 Node 是 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
        }
    ]
}

jsconfig.json

{
    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "module": "amd",
        "target": "ES6" 
    },
    "files": []
}

Debian 外壳

demetrio@nodejs ~/tool/elasticsearch-head $ node -v
v7.7.4

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

最佳答案

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

'协议(protocol)':'旧版'

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

'协议(protocol)':'检查器'

最后是选项:

'协议(protocol)':'自动'

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

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

Feb 1.10 release

March 1.11 release

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

关于node.js - 如何取出 "Warning: This is an experimental feature and could change at any time"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43056946/

相关文章:

javascript - 如何在javascript中 trim 末尾不需要的连续字符串?

node.js - 在 node.js 应用程序中使用 q.all of q.js 实现并行异步

php - Ghost Blog Install 仅显示文件索引列表

node.js - 尝试运行示例的 gulp 问题 - 'The super constructor to ` 继承`不能为空或未定义。

ionic-framework - 语法错误 : Unexpected token [ - ionic

python - 如何将 "value"属性强类型为 str 或自定义类型?

visual-studio-code - 如何在 VSCode 中反向导航 Ctrl+单击文件?

node.js - 无法让 git 停止跟踪 package-lock.json

visual-studio-code - 无法在 VSCode 上远程 SSH 到 Windows 主机

node.js - Bull MQ 可重复作业未触发