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

The Vue Semantic Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. #3364

Closed
jamessawyer opened this issue Jul 5, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@jamessawyer
Copy link

Error details:

/home/james/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:77
`,useCaseSensitiveFileNames:s?.useCaseSensitiveFileNames??!1,realpath:s?.realpath,write:s?.write??(()=>{}),writeFile:s?.writeFile??(()=>{}),createDirectory:s?.createDirectory??(()=>{}),exit:s?.exit??(()=>{}),getExecutingFilePath:s?.getExecutingFilePath??(()=>i+"/__fake__.js"),getCurrentDirectory:()=>i,getModifiedTime:u,readFile:p,readDirectory:f,getDirectories:b,resolvePath:c,fileExists:d,directoryExists:h,async sync(){for(;a.size;)await Promise.all(a);return r}};function c(k){if(s){if(vL!==i&&(vL=i,s.directoryExists(i)))try{process.chdir(i)}catch{}return s.resolvePath(k).replace(/\\/g,"/")}return ji.posix.resolve(k).replace(/\\/g,"/")}function u(k){k=c(k);let E=ji.posix.dirname(k),C=m(E),_=ji.posix.basename(k),x=C.files[_]?.modifiedTime;if(x!==void 0)return new Date(x)}function p(k,E){k=c(k);let C=ji.posix.dirname(k),_=m(C),x=ji.posix.basename(k);return w(k,E,_),_.files[x]?.text}function h(k){k=c(k);let E=m(k);if(k==="/node_modules"&&n)E.exists=!0;else if(k.startsWith("/node_modules/")&&n&&!(0,iae.getPackageNameOfDtsPath)(k))E.exists=!0;else if(E.exists===void 0){E.exists=!1;let C=k.startsWith("/node_modules/")&&n?n.stat(k):t.fs?.stat(t.fileNameToUri(k));if(typeof C=="object"&&"then"in C){let _=C;a.add(_),C.then(x=>{a.delete(_),E.exists=x?.type===2,E.exists&&r++})}else E.exists=C?.type===2}return E.exists}function d(k){k=c(k);let E=ji.posix.dirname(k),C=ji.posix.basename(k),_=m(E),x=_.files[C]??={};if(x.exists===void 0){x.exists=!1;let T=k.startsWith("/node_modules/")&&n?n.stat(k):t.fs?.stat(t.fileNameToUri(k));if(typeof T=="object"&&"then"in T){let D=T;a.add(D),T.then(P=>{if(a.delete(D),x.exists=P?.type===1,x.exists){let F=Date.now();x.modifiedTime=F!==x.modifiedTime?F:x.modifiedTime+1,r++}})}else x.exists=T?.type===1}return x.exists}function b(k){k=c(k),S(k);let E=m(k);return[...Object.entries(E.dirs)].filter(([C,_])=>_.exists).map(([C])=>C)}function f(k,E,C,_,x){k=c(k);let T=(0,rae.matchFiles)(k,E,C,_,s?.useCaseSensitiveFileNames??!1,i,x,D=>{D=c(D),S(D);let P=m(D);return{files:[...Object.entries(P.files)].filter(([F,O])=>O.exists).map(([F])=>F),directories:[...Object.entries(P.dirs)].filter(([F,O])=>O.exists).map(([F])=>F)}},s?.realpath?D=>s.realpath(D):D=>D);return[...new Set(T)]}function w(k,E,C){let _=ji.posix.basename(k);C.files[_]??={};let x=C.files[_];if(x.exists===!1||x.requested)return;x.requested=!0;let T=t.fileNameToUri(k),D=k.startsWith("/node_modules/")&&n?n.readFile(k):t.fs?.readFile(T,E);if(typeof D=="object"&&"then"in D){let P=D;a.add(P),D.then(F=>{if(a.delete(P),F!==void 0){x.exists=!0,x.text=F;let O=Date.now();x.modifiedTime=O!==x.modifiedTime?O:O+1,r++}else x.exists=!1})}else if(D!==void 0){x.exists=!0,x.text=D;let P=Date.now();x.modifiedTime=P!==x.modifiedTime?P:P+1}else x.exists=!1}function S(k){let E=m(k);if(E.requested)return;E.requested=!0;let C=k.startsWith("/node_modules/")&&n?n.readDirectory(k):t.fs?.readDirectory(t.fileNameToUri(k||"."));if(typeof C=="object"&&"then"in C){let _=C;a.add(_),C.then(x=>{a.delete(_),v(k,E,x)&&r++})}else v(k,E,C??[])}function v(k,E,C){C=C.filter(([x])=>x!=="."&&x!=="..");let _=!1;for(let[x,T]of C){let D=T;if(D===64){let P=t.fs?.stat(t.fileNameToUri(k+"/"+x));if(typeof P=="object"&&"then"in P){let F=P;a.add(F),P.then(O=>{if(a.delete(F),O?.type===1)E.files[x]??={},E.files[x].exists||(E.files[x].exists=!0,r++);else if(O?.type===2){let j=g(E,x);j.exists||(j.exists=!0,r++)}})}else P&&(D=P.type)}if(D===1)E.files[x]??={},E.files[x].exists||(E.files[x].exists=!0,_=!0);else if(D===2){let P=g(E,x);P.exists||(P.exists=!0,_=!0)}}return _}function m(k){let E=[],C=k,_=ji.posix.basename(C),x;for(;x!==C;)x=C,E.push(_),C=ji.posix.dirname(C),_=ji.posix.basename(C);let T=o;for(let D=E.length-1;D>=0;D--){let P=E[D];T=g(T,P)}return T}function g(k,E){let C=k.dirs[E];return C||(C={dirs:{},files:{}},k.dirs[E]=C),C}}Zy.createSys=sae});var wL=M(ew=>{"use strict";Object.defineProperty(ew,"__esModule",{value:!0});ew.getProgram=void 0;function oae(e,t,n,r){let i={getRootFileNames:o,emit:h,getSyntacticDiagnostics:l,getSemanticDiagnostics:c,getGlobalDiagnostics:p,getBindAndCheckDiagnostics:a};return new Proxy({},{get:(b,f)=>{if(f in i)return i[f];let w=s();return f in w?w[f]:b[f]},set:(b,f,w)=>{let S=s();return b[f]=S[f]=w,!0}});function s(){return n.getProgram()}function o(){return s().getRootFileNames().filter(b=>r.fileExists?.(b))}function a(b,f){return u(b,f,"getBindAndCheckDiagnostics")}function l(b,f){return u(b,f,"getSyntacticDiagnostics")}function c(b,f){return u(b,f,"getSemanticDiagnostics")}function u(b,f,w){if(b){let[S,v]=t.virtualFiles.getVirtualFile(b.fileName);if(S&&v)return S.capabilities.diagnostic?d(n.getProgram()?.[w](b,f)??[]):[]}return d(s()[w](b,f)??[])}function p(b){return d(s().getGlobalDiagnostics(b)??[])}function h(b,f,w,S,v){let m=s().emit(b,r.writeFile??e.sys.writeFile,w,S,v);return{emitSkipped:m.emitSkipped,emittedFiles:m.emittedFiles,diagnostics:d(m.diagnostics)}}function d(b){let f=[];for(let S of b)if(S.file!==void 0&&S.start!==void 0&&S.length!==void 0){let[v,m]=t.virtualFiles.getVirtualFile(S.file.fileName);if(v&&m){if(r.fileExists?.(m.fileName)===!1)continue;for(let[g,[k,E]]of t.virtualFiles.getMaps(v))if(k===m.snapshot){for(let C of E.toSourceOffsets(S.start))if(!!(typeof C[1].data.diagnostic=="object"?C[1].data.diagnostic.shouldReport():!!C[1].data.diagnostic)){for(let x of E.toSourceOffsets(S.start+S.length,!0))if(!!(typeof x[1].data.diagnostic=="object"?x[1].data.diagnostic.shouldReport():!!x[1].data.diagnostic)){w(S,m.fileName,C[0],x[0],m.snapshot.getText(0,m.snapshot.getLength()));break}break}}}else{if(r.fileExists?.(S.file.fileName)===!1)continue;w(S,S.file.fileName,S.start,S.start+S.length,S.file.text)}}else S.file===void 0&&f.push(S);return f;function w(S,v,m,g,k){let E=v===S.file?.fileName?S.file:void 0;if(!E)if(k===void 0){let x=t.host.getScriptSnapshot(v);x&&(k=x.getText(0,x.getLength()))}else E=e.createSourceFile(v,k,e.ScriptTarget.Latest,void 0,e.ScriptKind.Deferred),E.originalFileName=v,E.path=v.toLowerCase(),E.resolvedPath=v.toLowerCase();let C={...S,file:E,start:m,length:g-m},_=S.relatedInformation;_&&(C.relatedInformation=d(_)),f.push(C)}}}ew.getProgram=oae});var SL=M(tw=>{"use strict";Object.defineProperty(tw,"__esModule",{value:!0});tw.decorateLanguageServiceHost=void 0;var xL=hr();function aae(e,t,n,r){let i=0,s=new Map,o=t.resolveModuleNameLiterals?.bind(t),a=t.resolveModuleNames?.bind(t),l=t.getProjectVersion?.bind(t),c=t.getScriptFileNames.bind(t),u=t.getScriptSnapshot.bind(t);o?t.resolveModuleNameLiterals=(b,f,w,S,...v)=>{let m=o(b,f,w,S,...v);return b.map((g,k)=>r.some(E=>g.text.endsWith(E))?p(g.text,f,S,w):m[k])}:a&&(t.resolveModuleNames=(b,f,w,S,v,m)=>{let g=a(b,f,w,S,v,m);return b.map((k,E)=>r.some(C=>k.endsWith(C))?p(k,f,v,S).resolvedModule:g[E])}),l&&(t.getProjectVersion=()=>l()+":"+i),t.getScriptFileNames=()=>t.getCompilationSettings().composite?[...c(),...e.allSources().map(b=>b.fileName)]:c(),t.getScriptSnapshot=b=>(s.has(b)&&d(b),s.get(b)?.snapshot??u(b));function p(b,f,w,S){let v=n.resolveModuleName(b,f,w,{readFile(m){return t.readFile(m)},fileExists(m){return r.some(g=>m.endsWith(g+".d.ts"))?h(m.slice(0,-5)):t.fileExists(m)}},void 0,S);if(v.resolvedModule){v.resolvedModule.resolvedFileName=v.resolvedModule.resolvedFileName.slice(0,-5);let m=d(v.resolvedModule.resolvedFileName);m&&(v.resolvedModule.extension=m.extension)}return v}function h(b){return t.fileExists(b)?(n.sys.getFileSize?.(b)??t.readFile(b)?.length??0)<4*1024*1024:!1}function d(b){let f=t.getScriptVersion(b);if(f!==s.get(b)?.version){let w=t.readFile(b),S,v=".ts";if(w!==void 0){i++;let m=e.updateSource(b,n.ScriptSnapshot.fromString(w),void 0);if(m){let g=w.split(`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

TypeError: Cannot read properties of undefined (reading 'index.d.vue.ts')
    at Object.d [as fileExists] (/home/james/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:77:1416)
    at Proxy.v (/home/james/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:76:37791)
    at Object.fileExists (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:139762:40)
    at Object.host.fileExists (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:116036:43)
    at Object.fileExists (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:119567:30)
    at tryFileLookup (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:40169:22)
    at tryFile (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:40160:14)
    at tryExtension (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:40153:20)
    at tryAddingExtensions (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:40150:109)
    at loadModuleFromFileNoImplicitExtensions (/home/james/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:40110:12)

Associated infos:

node: v18.16.0
yarn: 1.22.19
development environment: WSL2


# main packages
"vue": "^3.2.37",
"typescript": "^5.0.4"
"vite": "^4.3.7"

VSCode plugins:

Vue Language Features (Volar):1.8.3
TypeScript Vue Plugin (Volar):1.8.3

local vscode settings.json:

{
  "typescript.tsdk": "./node_modules/typescript/lib"
}

I tried to remove settings.json file and reload vscode, still got no luck.
I reviewed #3246 issue, and 'JavaScript and TypeScript Nightly' plugin not installed.
It's so frustrate to get this error all the time. Help Wanted!

@jamessawyer
Copy link
Author

tsconfig.json file:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "allowJs": true,
    "lib": ["ESNext", "DOM"],
    "skipLibCheck": true,
    "baseUrl":".",
    "paths": {
      "@/*": ["src/*"],
    },
    "types": ["pinia-plugin-persist", "vite/client"],
    "strictNullChecks": false,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "noImplicitAny": false,
    "importsNotUsedAsValues": "preserve",
    "ignoreDeprecations": "5.0",
    "outDir": "./dist"
  },
  "include": [
    "types/**/*.d.ts",
    "*.ts",
    "src/**/*.ts", 
    "src/**/*.d.ts", 
    "src/**/*.tsx", 
    "src/**/*.vue" ,
    "vite.config.ts"
  ],
  "exclude": ["node_modules", "tsconfig.node.json", "dist"]
}

@johnsoncodehk
Copy link
Member

Duplicate of # #3336

Can you reproduce this problem in http://github.com/johnsoncodehk/volar-starter ? Unfortunately I don't use Windows so can't check with WSL2.

@jamessawyer
Copy link
Author

It goes smooth with https://github.com/johnsoncodehk/volar-starter and any new vue-ts projects.
It seems the problem only happens in my own project, it's mystifying. I also reinstall my project in Windows 11 environment, no luck.

@setterlee
Copy link

Im getting an issue like this in my vscode using WSL2, I just started a new project in Vue3 with the npm init command and added Primevue for the UI and I have this errors:

TypeError: Cannot read properties of undefined (reading '.eslintrc.cjs')
    at v (/home/setterlee/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:77:3428)
    at S (/home/setterlee/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:77:3018)
    at /home/setterlee/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:77:1988
    at w (/home/setterlee/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:76:33031)
    at Yoe (/home/setterlee/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:76:32885)
    at Proxy.f (/home/setterlee/.vscode-server/extensions/vue.volar-1.8.3/dist/server.js:77:1931)
    at getFileNamesFromConfigSpecs (/home/setterlee/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:36960:31)
    at getFileNames (/home/setterlee/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:36515:25)
    at parseJsonConfigFileContentWorker (/home/setterlee/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:36436:18)
    at Object.parseJsonConfigFileContent (/home/setterlee/.vscode-server/bin/695af097c7bd098fbf017ce3ac85e09bbc5dda06/extensions/node_modules/typescript/lib/typescript.js:36376:12)

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Jul 5, 2023
@franz-bendezu
Copy link

franz-bendezu commented Aug 12, 2023

Hello, @johnsoncodehk . I've thoroughly investigated the issue, and it appears that, on occasion, there are files or directories that aren't being located correctly on Windows.

To gain a deeper understanding of the problem, we need to look further into the specifics. For example, I examined a package that contained both compiled JS and d.ts files. There seems to be a potential conflict, although I cannot confirm this with absolute certainty.

The most expedient solution, which will also prevent similar errors in the future, is to assume that files and directories might not exist. I've implemented this change in the "volar" codebase. Could you kindly review it?

volarjs/volar.js#59

@johnsoncodehk
Copy link
Member

@franz-bendezu Thanks for looking into it! I haven't merged the PR yet, but I packaged it if anyone needs it.

volar-1.8.8-patch.1.vsix.zip

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
Development

No branches or pull requests

4 participants