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

Node.js paths on macOS are case sensitive #1682

Open
Jack-Works opened this issue Apr 27, 2023 · 7 comments
Open

Node.js paths on macOS are case sensitive #1682

Jack-Works opened this issue Apr 27, 2023 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@Jack-Works
Copy link

Describe the bug
Cannot find source map.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/microsoft/TypeScript
  2. Run npx hereby watch-min
  3. Use the following launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Mocha Tests (currently opened test)",
            "runtimeArgs": ["--nolazy"],
            "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
            "args": [
                "-u",
                "bdd",
                "--no-timeouts",
                "--colors",
                "built/local/run.js",
                "-f",
                // You can change this to be the name of a specific test file (without the file extension)
                // to consistently launch the same test
                "${fileBasenameNoExtension}",
                "--skip-percent",
                "0"
            ],
            "env": {
                "NODE_ENV": "testing"
            },
            "outFiles": [
                "${workspaceFolder}/built/**/*.js",
                "${workspaceFolder}/built/**/*.mjs",
                "${workspaceFolder}/built/**/*.cjs",
                "!**/node_modules/**"
            ],
            "sourceMaps": true,
            "smartStep": true,
            "preLaunchTask": "npm: build:tests",
            "console": "integratedTerminal",
            "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
        },
        {
            // See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
            "type": "node",
            "request": "attach",
            "name": "Attach to VS Code TS Server via Port",
            "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue",
            "sourceMaps": true,
            "outFiles": ["${workspaceFolder}/built/local/*.js", "!**/node_modules/**"],
            "enableTurboSourcemaps": true,
            "port": 5667,
            "trace": true
        },
        {
            "type": "node",
            "name": "Launch VSCode",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": ["--user-data-dir=${workspaceFolder}/.vscode/.vscode-debug", "${workspaceFolder}/../"],
            "env": {
                "TSS_DEBUG": "5667",
                "NODE_ENV": "development"
            }
        }
    ]
}

Start VSCode and then attach to the language service.

Log File

vscode-debugadapter-cff4305c.json.gz

I found there is something strange happened in the logfile:

image

Version: 1.77.3 (Universal)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:19:37.325Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin arm64 22.4.0
Sandboxed: No

JavaScript Debugger (Nightly)
v2023.4.1317

@Jack-Works Jack-Works added the bug Issue identified by VS Code Team member as probable bug label Apr 27, 2023
@connor4312
Copy link
Member

Functional duplicate of #1646

@Jack-Works
Copy link
Author

@connor4312 I'm using the latest nightly version and still have this problem. are you sure it's the same problem?

@connor4312
Copy link
Member

Can you confirm what version of nightly you're running? THere was an issue in our pipelines that prevented it getting published for a little while

@Jack-Works
Copy link
Author

Can you confirm what version of nightly you're running? THere was an issue in our pipelines that prevented it getting published for a little while

I tried v2023.4.2817

@Jack-Works
Copy link
Author

I tried chrome devtools and it can bind breakpoint.

@Jack-Works
Copy link
Author

ok, I figured out why. It's about the case-insensitive file system (macOS default).

I started the program with TypeScript/built/local, but I use typescript/ to develop, therefore ${workspaceFolder}/built/local becomes typescript/built/local and mismatched with the started program.

cc @connor4312 can you open the issue? although I have already fixed the problem by making the file casting consistent.

@connor4312 connor4312 reopened this Apr 30, 2023
@connor4312 connor4312 changed the title Breakpoint not set Node.js paths on macOS are case sensitive Apr 30, 2023
@justingrant
Copy link

I think I just hit this bug (also on MacOS) in a much simpler case without any source maps or transpilation, just a simple node foo.mjs command.

Node ran the file (and debugger statements broke into the debugger) but breakpoints weren't bound.

Here's my config, in case it's helpful:

    {
      "name": "validstrings.mjs",
      "request": "launch",
      "type": "node",
      "runtimeArgs": ["polyfill/test/validstrings.mjs"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "autoAttachChildProcesses": true,
      "skipFiles": [
        "<node_internals>/**",
        "**/node_modules/**"
      ]
    },

Once I fixed the filename to the actual "validStrings.mjs" (capital S) then it worked great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants