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

vue-tsc not work with typescript 5.7.2 #5018

Open
devhaozi opened this issue Nov 22, 2024 · 17 comments · May be fixed by #5020
Open

vue-tsc not work with typescript 5.7.2 #5018

devhaozi opened this issue Nov 22, 2024 · 17 comments · May be fixed by #5020
Labels
bug Something isn't working ❗ p4-important

Comments

@devhaozi
Copy link

Vue - Official extension or vue-tsc version

2.1.10

VSCode version

none

Vue version

3.5.13

TypeScript version

5.7.2

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 6800H with Radeon Graphics         
    Memory: 9.81 GB / 31.21 GB
  Binaries:
    Node: 20.15.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.13.2 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (129.0.2792.79)
    Internet Explorer: 11.0.26100.1882


### package.json dependencies

```json
{
  "dependencies": {
    "@fontsource-variable/jetbrains-mono": "^5.1.1",
    "@guolao/vue-monaco-editor": "^1.5.4",
    "@vue-js-cron/naive-ui": "^2.0.9",
    "@vueuse/core": "^11.3.0",
    "@xterm/addon-attach": "^0.11.0",
    "@xterm/addon-clipboard": "^0.1.0",
    "@xterm/addon-fit": "^0.10.0",
    "@xterm/addon-unicode11": "^0.8.0",
    "@xterm/addon-web-links": "^0.11.0",
    "@xterm/addon-webgl": "^0.18.0",
    "@xterm/xterm": "^5.5.0",
    "alova": "^3.2.4",
    "axios": "^1.7.7",
    "cronstrue": "^2.52.0",
    "echarts": "^5.5.1",
    "install": "^0.13.0",
    "lodash-es": "^4.17.21",
    "luxon": "^3.5.0",
    "marked": "^15.0.2",
    "mitt": "^3.0.1",
    "pinia": "^2.2.6",
    "pinia-plugin-persistedstate": "^4.1.3",
    "remove": "^0.1.5",
    "vue": "^3.5.13",
    "vue-echarts": "^7.0.3",
    "vue-i18n": "^10.0.4",
    "vue-router": "^4.4.5"
  },
  "devDependencies": {
    "@iconify/json": "^2.2.275",
    "@iconify/vue": "^4.1.2",
    "@rushstack/eslint-patch": "^1.10.4",
    "@tsconfig/node20": "^20.1.4",
    "@types/lodash-es": "^4.17.12",
    "@types/luxon": "^3.4.2",
    "@types/node": "^22.9.1",
    "@unocss/eslint-config": "^0.64.1",
    "@vitejs/plugin-vue": "^5.2.0",
    "@vue/eslint-config-prettier": "^10.1.0",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/tsconfig": "^0.6.0",
    "colord": "^2.9.3",
    "eslint": "^8.57.1",
    "eslint-plugin-vue": "^9.31.0",
    "md-editor-v3": "^5.0.2",
    "monaco-editor": "^0.52.0",
    "naive-ui": "^2.40.1",
    "npm-run-all2": "^7.0.1",
    "prettier": "^3.3.3",
    "prettier-plugin-organize-imports": "^4.1.0",
    "sass": "^1.81.0",
    "typescript": "^5.7.2",
    "unocss": "^0.64.1",
    "unplugin-auto-import": "^0.18.5",
    "unplugin-icons": "^0.20.1",
    "unplugin-vue-components": "^0.27.4",
    "vite": "^5.4.11",
    "vite-plugin-html": "^3.2.2",
    "vite-plugin-mock": "^3.0.2",
    "vite-plugin-static-copy": "^2.1.0",
    "vue-tsc": "^2.1.10"
  }
}

Steps to reproduce

update typescript to 5.7.2

What is expected?

no error

What is actually happening?

throw error:

C:\path\to\project\node_modules\.pnpm\[email protected][email protected]\node_modules\vue-tsc\index.js:34
            throw err;
            ^
Search string not found: "/supportedTSExtensions = .*(?=;)/"
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v20.15.0
 ELIFECYCLE  Command failed with exit code 1.
ERROR: "type-check" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.

Link to minimal reproduction

No response

Any additional comments?

No response

@pzgz
Copy link

pzgz commented Nov 22, 2024

Excatly same error message, tried 2.1.6 and 2.1.10

CleanShot 2024-11-23 at 02 51 26@2x

@acabreragnz
Copy link

Same here, in my local works but not in the CD pipeline 🤔

image

@acabreragnz
Copy link

I found the issue, Typescript was updated 1 hour ago to version 5.7.2.

For me, version 5.6.2 is working.

@teles
Copy link

teles commented Nov 22, 2024

I am experiencing the same problem when using vue-tsc version 2.1.10 with TypeScript 5.7.2. The error occurs when running the build script using pnpm

/node_modules/.pnpm/[email protected][email protected]/node_modules/vue-tsc/index.js:34
            throw err;
            ^
Search string not found: "/supportedTSExtensions = .*(?=;)/"
Node.js v22.11.0

To resolve this issue temporarily, I had to downgrade:

  • vue-tsc to version 2.0.29
  • typescript to version 5.6.2

Here is the updated portion of my package.json after the downgrade:

{
  "scripts": {
    "build": "vue-tsc -b && vite build"
    },
  "devDependencies": {
      "vue-tsc": "2.0.29",
      "typescript": "5.6.2",
      "vite": "^5.4.10",
      "@vitejs/plugin-vue": "^5.1.4"
  }
}

This downgrade fixed the issue. It appears to be related to an incompatibility between [email protected] and TypeScript 5.7.x.

@TimJohns
Copy link

TimJohns commented Nov 22, 2024

The incompatibility appears to be in the Volar repo, specifically where @volar/typescript patches the tsc code, because the tsc code changed with the typescript 5.7 release.

I was a little late to the Vue ecosystem and I haven't followed the Volar discussion, so I'm not 100% sure, but I believe Volar is a standalone project now. I'm wondering if this issue may be more appropriately handled over there, since Volar supports other TypeScript-based languages that are impacted by this issue. I searched the issues there, and didn't find anything yet, but it may just be that fresh, since TypeScript 5.7.2 is only about 5 hours old.

In the mean time, pinning TypeScript at 5.6.3 and allowing vue-tsc to go to 2.1.10 works for me.

@Dedicatus546
Copy link

same here

@sminnee
Copy link

sminnee commented Nov 25, 2024

At

export function run(tscPath = require.resolve('typescript/lib/tsc')) {
the file typescript/lib/tsc.js is referenced.

This file is now typescript/lib/_tsc.js, because the former file is now just a shim.

To work in all typescript versions, it would need to apply the transformations on both typescript/lib/tsc.js and typescript/lib/_tsc.js, and avoid throwing an error if the search text isn't found.

It might be worth updating https://github.com/volarjs/volar.js/blob/master/packages/typescript/lib/quickstart/runTsc.ts#L11 to:

  • accept either a string[] or a string for the tscPath.
  • accept an option to disable 'search text not found' errors.

@JaguarJack
Copy link

This has a huge impact. When will the version be released to solve this problem?

anne-ds added a commit to digitalservicebund/ris-backend-service that referenced this issue Nov 26, 2024
Stay on old typescript version (5.6.3) as the latest is not compatible to vue-tsc 2.2.10 (vuejs/language-tools#5018)
RISDEV-0000
@RomkaLTU
Copy link

RomkaLTU commented Nov 26, 2024

Nothing helped. I still get the same error even after downgrading the mentioned packages. Another solution with a patch is not clear. I can't find this file, and I don't use ppm. I just building without vue-tsc "build": "vite build && vite build --ssr", temporary.

@nosdmitry
Copy link

I use this command npx --yes -p [email protected] --yes -p [email protected] vue-tsc --noEmit --skipLibCheck and it works fine on my local server.

But it continues falling with the same error on pipeline in gitlab.
I'm confused, everything worked fine until this Monday..

/root/.npm/_npx/4e06f8b322b12674/node_modules/vue-tsc/index.js:45
            throw err;
            ^
Search string not found: "/supportedTSExtensions = .*(?=;)/"

@Andrija84
Copy link

At

export function run(tscPath = require.resolve('typescript/lib/tsc')) {

the file typescript/lib/tsc.js is referenced.
This file is now typescript/lib/_tsc.js, because the former file is now just a shim.

To work in all typescript versions, it would need to apply the transformations on both typescript/lib/tsc.js and typescript/lib/_tsc.js, and avoid throwing an error if the search text isn't found.

It might be worth updating https://github.com/volarjs/volar.js/blob/master/packages/typescript/lib/quickstart/runTsc.ts#L11 to:

  • accept either a string[] or a string for the tscPath.
  • accept an option to disable 'search text not found' errors.

I was able to fix this issue by changing the lib path which is now different, like above comment described. Why this sudden change I cant figure out

@davidmatter
Copy link
Collaborator

If my proposed patching solution doesn't work for you guys, consider using overrides to forcibly downgrade the resolved typescript version to the last minor. Here are the docs for pnpm or npm or yarn

@khofaai
Copy link

khofaai commented Nov 27, 2024

Same issue with [email protected] and [email protected] none of the solution above worked for me :(

/path/to/repo/node_modules/vue-tsc/index.js:34
image

what i've found so far is that the error is triggered by replace function in node_modules/@volar/typescript/lib/quickstart/runTsc.js. as for now i think i'm forced to build the my vue app without any vue-tsc hecks

@wkrick
Copy link

wkrick commented Nov 27, 2024

I'm getting the same error. It doesn't seem to matter what older versions of typescript or vue-tsc that I try. So I'm not convinced that typescript is the actual problem.

<redacted>\node_modules\vue-tsc\index.js:34
            throw err;
            ^
Search string not found: "/supportedTSExtensions = .*(?=;)/"
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v18.17.0

EDIT: I recreated my project using the latest Vite template and using these dependencies it now builds without the error...

  "devDependencies": {
    "@vitejs/plugin-vue": "^5.2.1",
    "typescript": "~5.6.2",
    "vite": "^6.0.1",
    "vue-tsc": "^2.1.10"
  }

@teles
Copy link

teles commented Nov 27, 2024

I wanted to share that, as a palliative solution, I resolved the issue by using these specific versions in my package.json without the ^ at the beginning:

"devDependencies": {
  "typescript": "5.6.2",
  "vue-tsc": "2.0.29"
}

After making this change, the problem stopped occurring for me.
Hope this helps as a temporary workaround!

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

Successfully merging a pull request may close this issue.