【问题标题】:VSCode NodeJS debugging allow HTTPSVSCode NodeJS 调试允许 HTTPS
【发布时间】:2022-01-16 11:34:15
【问题描述】:

我正在努力配置 VSCode launch.json 以通过 HTTPS 协议上的 yarn start -ssl 命令运行 NodeJS 服务器。

我的 launch.json 是:

    {
        "command": "yarn start --ssl",
        "name": "SienaFE",
        "request": "launch",
        "type": "node-terminal",
        "cwd": "${workspaceFolder}/SienaFE",
    }

忽略 --ssl 属性。我想以这种方式启动服务器,以便我可以访问 VS 代码中的 JS 调试以及 VS 代码中的终端输出。

但是它只在 HTTP 上启动服务器。

谁能帮我配置在 HTTPS 上运行 NodeJS?

非常感谢!

【问题讨论】:

    标签: node.js visual-studio-code https yarnpkg


    【解决方案1】:

    问题不在 VSCode 的 launch.json 配置中,而是在 React-Scripts 的 NodeJS package.json 配置中:

    "scripts": 
    {
        "start": "HTTPS=true react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start --ssl"
    }
    

    "start": "HTTPS=true react-scripts start"。

    更多信息:https://create-react-app.dev/docs/using-https-in-development/

    【讨论】:

      猜你喜欢
      • 2020-10-24
      • 2021-10-22
      • 2021-08-05
      • 2015-11-15
      • 2018-01-14
      • 2019-07-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      相关资源
      最近更新 更多