Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调试的问题 #286

Closed
Kerwin1202 opened this issue Mar 4, 2023 · 2 comments · Fixed by #296
Closed

调试的问题 #286

Kerwin1202 opened this issue Mar 4, 2023 · 2 comments · Fixed by #296

Comments

@Kerwin1202
Copy link

按照 README 可以跑 pnpm start,但是想 vs code 调试
新加了 tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "typescript",
      "tsconfig": "service/tsconfig.json",
      "problemMatcher": [
        "$tsc"
      ],
      "group": "build",
      "label": "tsc: 构建 - service/tsconfig.json"
    }
  ]
}

launch.json

{
  // 使用 IntelliSense 了解相关属性。
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "server",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "preLaunchTask": "tsc: 构建 - service/tsconfig.json",
      "program": "${workspaceFolder}/service/src/index.ts",
      "sourceMaps": true,
      // "restart": true,
      "outFiles": [
        "${workspaceFolder}/**/*.js"
      ]
    }
  ]
}

结果就是各种错

import express from 'express'
^^^^^^

SyntaxError: Cannot use import statement outside a module

网上说 改 tsc 的配置 "module": "esnext" 结果又有别的错

@uxiew
Copy link
Contributor

uxiew commented Mar 5, 2023

launch.json:

{
  // Use IntelliSense to learn about possible 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": "chrome",
      "request": "launch",
      "name": "Launch Web App",
      "url": "http://localhost:1002",
      "webRoot": "${workspaceFolder}"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Service Server",
      "runtimeExecutable": "${workspaceFolder}/service/node_modules/.bin/esno",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}/service/src/index.ts",
      "outFiles": ["${workspaceFolder}/service/**/*.js"],
      "envFile": "${workspaceFolder}/service/.env"
    }
  ]
}

@Kerwin1202
Copy link
Author

可以了 多谢

JasonLiuLiuLiuLiu pushed a commit to JasonLiuLiuLiuLiu/chatgpt-web that referenced this issue Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants