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

Throw an error when composite is enabled #2622

Closed
sxzz opened this issue Apr 18, 2023 · 11 comments · Fixed by #3556
Closed

Throw an error when composite is enabled #2622

sxzz opened this issue Apr 18, 2023 · 11 comments · Fixed by #3556
Labels
bug Something isn't working

Comments

@sxzz
Copy link
Member

sxzz commented Apr 18, 2023

Reproduction: sxzz/volar-starter@e83eb07

/project/node_modules/.pnpm/vue-tsc@1.3.16_typescript@5.0.4/node_modules/vue-tsc/bin/vue-tsc.js:53
                        throw err;
                        ^

Error: Debug Failure. False expression: Paths must either both be absolute or both be relative
    at getRelativePathFromDirectory (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:5717:9)
    at relativeToBuildInfo (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:117152:38)
    at convertToReusableDiagnosticRelatedInformation (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:117237:18)
    at /project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:117223:20
    at Array.map (<anonymous>)
    at convertToReusableDiagnostics (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:117222:22)
    at getBuildInfo2 (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:117099:11)
    at newProgram.getBuildInfo (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/tsc.js:117309:41)
    at Object.getBuildInfo (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/typescript.js:116651:70)
    at emitBuildInfo (/project/node_modules/.pnpm/typescript@5.0.4/node_modules/typescript/lib/typescript.js:109453:30)
@johnsoncodehk johnsoncodehk added the bug Something isn't working label Apr 20, 2023
@johnsoncodehk johnsoncodehk reopened this Apr 22, 2023
@Mostaard
Copy link

I'm encountering the same issue

@stefanprobst
Copy link

i am getting the same error with "incremental": true

@fdc-viktor-luft
Copy link

fdc-viktor-luft commented Apr 26, 2023

I have the same error with version 1.4.4. Funnily, when downgrading to 1.4.0 I get a different error:

composite / incremental is not supported

The error still exists in 1.5.3.

In version 1.3.9 it still works and it breaks using version higher than 1.3.10

Update: For some reason the version 1.3.9 only worked locally, but didn't pass the pipeline checks 🤔

@FabianMontoya
Copy link

FabianMontoya commented May 2, 2023

I have the same error:

Running npm run type-check that execute vue-tsc --noEmit

> vue-tsc --noEmit

[root path...]/vue-app/node_modules/vue-tsc/bin/vue-tsc.js:53
			throw err;
			^

Error: Debug Failure. False expression: Paths must either both be absolute or both be relative
    at getRelativePathFromDirectory (.../vue-app/node_modules/typescript/lib/tsc.js:5717:9)
    at relativeToBuildInfo (.../vue-app/node_modules/typescript/lib/tsc.js:117152:38)
    at convertToReusableDiagnosticRelatedInformation (.../vue-app/node_modules/typescript/lib/tsc.js:117237:18)
    at .../vue-app/node_modules/typescript/lib/tsc.js:117223:20
    at Array.map (<anonymous>)
    at convertToReusableDiagnostics (.../vue-app/node_modules/typescript/lib/tsc.js:117222:22)
    at getBuildInfo2 (.../vue-app/node_modules/typescript/lib/tsc.js:117099:11)
    at newProgram.getBuildInfo (.../vue-app/node_modules/typescript/lib/tsc.js:117309:41)
    at Object.getBuildInfo (.../vue-app/node_modules/typescript/lib/typescript.js:116651:70)
    at emitBuildInfo (.../vue-app/node_modules/typescript/lib/typescript.js:109453:30)

Node.js v18.14.2
"devDependencies": {
    "@tsconfig/node18": "^2.0.0",
    "@types/node": "^18.16.2",
    "@vitejs/plugin-vue": "^4.2.1",
    "@vue/tsconfig": "^0.3.2",
    "typescript": "~5.0.4",
    "vite": "^4.3.3",
    "vue-tsc": "^1.6.1"
  }

@Ragura
Copy link

Ragura commented May 10, 2023

This is also blocking us from upgrading.
Current related versions:
"typescript": "5.0.4"
"vue-tsc": "^1.6.4"

Contents of tsconfig:

{
  "compilerOptions": {
    "module": "ESNext",
    "target": "ESNext",
    "moduleResolution": "node",
    "lib": [
      "DOM",
      "ESNext",
      "DOM.Iterable"
    ],
    "baseUrl": ".",
    "rootDir": "src",
    "strict": true,
    "alwaysStrict": true,
    "isolatedModules": true,
    "importsNotUsedAsValues": "error",
    "useDefineForClassFields": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "strictPropertyInitialization": true,
    "forceConsistentCasingInFileNames": true,
    "jsx": "preserve",
    "declaration": true,
    "declarationMap": true,
    "declarationDir": "dist",
    "outDir": "dist",
    "sourceMap": true,
    "composite": true,
    "types": [
      "vite/client",
      "vitest"
    ]
  },
  "paths": {
    "@apps/*": [
      "apps/*/src"
    ],
    "@packages/*": [
      "packages/*/src"
    ]
  },
  "exclude": [
    "node_modules"
  ],
}

@FabianMontoya
Copy link

I have the same error:

Running npm run type-check that execute vue-tsc --noEmit

> vue-tsc --noEmit

[root path...]/vue-app/node_modules/vue-tsc/bin/vue-tsc.js:53
			throw err;
			^

Error: Debug Failure. False expression: Paths must either both be absolute or both be relative
    at getRelativePathFromDirectory (.../vue-app/node_modules/typescript/lib/tsc.js:5717:9)
    at relativeToBuildInfo (.../vue-app/node_modules/typescript/lib/tsc.js:117152:38)
    at convertToReusableDiagnosticRelatedInformation (.../vue-app/node_modules/typescript/lib/tsc.js:117237:18)
    at .../vue-app/node_modules/typescript/lib/tsc.js:117223:20
    at Array.map (<anonymous>)
    at convertToReusableDiagnostics (.../vue-app/node_modules/typescript/lib/tsc.js:117222:22)
    at getBuildInfo2 (.../vue-app/node_modules/typescript/lib/tsc.js:117099:11)
    at newProgram.getBuildInfo (.../vue-app/node_modules/typescript/lib/tsc.js:117309:41)
    at Object.getBuildInfo (.../vue-app/node_modules/typescript/lib/typescript.js:116651:70)
    at emitBuildInfo (.../vue-app/node_modules/typescript/lib/typescript.js:109453:30)

Node.js v18.14.2
"devDependencies": {
    "@tsconfig/node18": "^2.0.0",
    "@types/node": "^18.16.2",
    "@vitejs/plugin-vue": "^4.2.1",
    "@vue/tsconfig": "^0.3.2",
    "typescript": "~5.0.4",
    "vite": "^4.3.3",
    "vue-tsc": "^1.6.1"
  }

I found that the error was a type error, but the type-check didn't show where was the error, only that throw, I had to open file by file and try to found where was the error and fixed it. 😠💀

@Ragura
Copy link

Ragura commented May 10, 2023

@FabianMontoya That's interesting, though it wouldn't explain why there is suddenly a type error to begin with after upgrading to the newer version. Do you remember what the type error was that you fixed? Perhaps it would give us an indication of where to look.

@FabianMontoya
Copy link

@FabianMontoya That's interesting, though it wouldn't explain why there is suddenly a type error to begin with after upgrading to the newer version. Do you remember what the type error was that you fixed? Perhaps it would give us an indication of where to look.

It was a error in a :key, I had an object and I was passing it as a value of the :key prop of a component, and it had an error said that I can't pass an object as value, only a string | number and I don't remember what else haha, but I only changed :key="myObject" to :key="myObject.id"; but it wasn't the only error, in other places I was getting errors of type, and I was getting the same throw err in the console.

sodatea added a commit to sodatea/language-tools that referenced this issue May 12, 2023
Fixes vuejs#2622

I don't know the exact detail of the crash, but I find that tsc crashed
because the `diagnostic.file` object is somehow missing a `resolvedPath`
field. Meanwhile, the `fileName` field is always present. So I just
added a fallback to `fileName` in the patch.

Maybe related: microsoft/TypeScript#54057

I only add it to the 5.0 branch because I haven't tested it on 4.x,
so let's play it safe.
sodatea added a commit to vuejs/create-vue that referenced this issue May 12, 2023
Fixes #267

Thanks @segevfiner for noticing this new feature!

Currently there's still a small annoyance that `vue-tsc` would output
an extra error message when there're type errors in `.vue` files
vuejs/language-tools#2622 But it works well
if there's no error.

I've already submitted a PR to address it vuejs/language-tools#3176
@Ragura
Copy link

Ragura commented May 12, 2023

I can confirm the report by @FabianMontoya and add some more information. In our own project, when we set composite: true in tsconfig.json, we get the Debug Failure. False expression: Paths must either both be absolute or both be relative error. However, when it is set to false, we see normal typescript errors. When fixing these errors and once again setting composite: true, the path error also goes away.
As such, it appears the composite setting will throw the error when even one typescript error is found in the code AND not report that error.
I don't know if the current PR related to this has taken this into account, but if so, thanks for the work!

@Shujee
Copy link

Shujee commented Aug 17, 2023

@Ragura Thank you for sharing that piece of information. In my case, changing composite to false simply builds the output correctly, without any errors. When I set it to true again, I see the dreaded Debug Failure. False expression: Paths must either both be absolute or both be relative message again. Not sure what composite really does, but I guess I can live without it for now.

@alessandrolattao
Copy link

@Ragura Thank you for sharing that piece of information. In my case, changing composite to false simply builds the output correctly, without any errors. When I set it to true again, I see the dreaded Debug Failure. False expression: Paths must either both be absolute or both be relative message again. Not sure what composite really does, but I guess I can live without it for now.

Same behaviour here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
9 participants