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

Error: No Project. When starting LS from a bundled electron Theia application #60

Closed
kittaakos opened this issue Sep 2, 2018 · 9 comments

Comments

@kittaakos
Copy link

I am not sure whether this issue belongs here or Theia.

When I open a Theia workspace with installed typescript npm dependency I get the following error. Few more things to note:

Terminal from Theia:

prprpr:theia akos.kitta$ pwd
/Users/akos.kitta/Desktop/theia
prprpr:theia akos.kitta$ which tsserver
prprpr:theia akos.kitta$ ./node_modules/.bin/tsserver --version
Content-Length: 76

{"seq":0,"type":"event","event":"typingsInstallerPid","body":{"pid":29149}}
^C
prprpr:theia akos.kitta$ tsserver --version
bash: tsserver: command not found
prprpr:theia akos.kitta$

Error:

root ERROR Error from definitions request: file:///Users/akos.kitta/Desktop/theia/packages/core/src/common/os.ts#32/16 Error: Request textDocument/definition failed with message: Error processing request. No Project.
Error: No Project.
    at Object.ThrowNoProject (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:92289:23)
    at ProjectService.getDefaultProjectForFile (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:94518:46)
    at IOSession.Session.getFileAndProjectWorker (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:96934:87)
    at IOSession.Session.getFileAndProject (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:96919:29)
    at IOSession.Session.getDefinition (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:96572:31)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:96044:61)
    at /Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:97580:88
    at IOSession.Session.executeWithRequestId (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:97571:28)
    at IOSession.Session.executeCommand (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:97580:33)
    at IOSession.Session.onMessage (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:97600:35)
    at Interface.<anonymous> (/Users/akos.kitta/Desktop/theia/node_modules/typescript/lib/tsserver.js:98831:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:280:10)
    at Interface._normalWrite (readline.js:422:12)
    at Socket.ondata (readline.js:139:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:597:20)
    at new ResponseError (file:///Users/akos.kitta/Desktop/theia-apps/theia-electron/dist/mac/Theia.app/Contents/Resources/app/lib/bundle.js:95354:28)
    at handleResponse (file:///Users/akos.kitta/Desktop/theia-apps/theia-electron/dist/mac/Theia.app/Contents/Resources/app/lib/bundle.js:94338:48)
    at processMessageQueue (file:///Users/akos.kitta/Desktop/theia-apps/theia-electron/dist/mac/Theia.app/Contents/Resources/app/lib/bundle.js:94166:17)
    at Immediate._onImmediate (file:///Users/akos.kitta/Desktop/theia-apps/theia-electron/dist/mac/Theia.app/Contents/Resources/app/lib/bundle.js:94150:13)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)
@kittaakos
Copy link
Author

It works when I install the typescript npm dependency to the global (npm i -g typescript) but it is not available from the Theia workspace.

Terminal from Theia:

prprpr:theia akos.kitta$ pwd
/Users/akos.kitta/Desktop/theia
prprpr:theia akos.kitta$ which tsserver
/Users/akos.kitta/.nvm/versions/node/v8.11.4/bin/tsserver
prprpr:theia akos.kitta$ tsserver --version
Content-Length: 76

{"seq":0,"type":"event","event":"typingsInstallerPid","body":{"pid":29514}}
^C
prprpr:theia akos.kitta$

Probably related to this: #28.

@mofux
Copy link

mofux commented Feb 19, 2019

I'm having a similar problem, it also only happens when running the language server from the packaged electron app. It looks like inside the packaged bundle the environment variables differ from the ones that you get when launching the app from the command line. If you inspect process.env.PATH from within the bundled electron app you will notice that it's missing the paths to the installed node executables - in my case the PATH looks like this:

/usr/bin:/bin:/usr/sbin:/sbin`

Running it through the shell shows this PATH which includes the paths to the node binary modules:

/Users/user/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/user/Git/enter-client/node_modules/.bin:/Users/user/.nvm/versions/node/v10.15.1/bin:/Users/user/.yarn/bin:/Users/user/.config/yarn/global/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I'm guessing the path is usually being set inside a .bash_profile or similar environment script that does not get invoked when starting the bundled electron app. Not sure if there is an easy way to fix it though.

@kittaakos
Copy link
Author

If you inspect process.env.PATH from within the bundled electron app you will notice that it's missing the paths to the installed node executables - in my case the PATH looks like this:

@mofux, what OS are you using? We used to have an issue with the PATH on macOS, but it was fixed with this.

Do you have the same problem if you build an electron application locally?

@mofux
Copy link

mofux commented Feb 19, 2019

@kittaakos Thanks for sharing your fix-path solution, that definitely seems to solve the path problem (I'm on MacOS). I'm still seeing a very strange problem though. When running in a bundled electron app (not theia, my own which uses typescript-language-server and monaco-languageclient) the tsconfig.json file does not seem to get resolved correctly from the language server. I don't get any obvious errors (--tsserver-log-file doesn't write a log file for some reason, so I can't inspect any deeper) and everything is working correctly, except that things like the lib section of my tsconfig.json are not being respected (I guess because they are never read). It doesn't happen when running the app with the electron executable directly.

Did you see a similar problem in Theia?

@kittaakos
Copy link
Author

running in a bundled electron app (not theia, my own which uses typescript-language-server and monaco-languageclient) the tsconfig.json file does not seem to get resolved correctly from the language server.

@akosyakov, can you please help with this?

--tsserver-log-file doesn't write a log file for some reason, so I can't inspect any deeper

This might worth a bug report.

Did you see a similar problem in Theia?

I am not aware of anything similar in Theia.

@mofux
Copy link

mofux commented Feb 19, 2019

@kittaakos Thanks for the response. The problem appears whenever the tsserver-path points to a file that is inside application package (e.g. /Applications/MyApp.app/Contents/Resources/app.asar.unpacked/node_modules/typescript/lib/tsserver.js). In my case, I wanted to make sure that I can start the LS even if the application runs on a device that has no typescript installed, so I used the --tsserver-path option to point towards the typescript i'm shipping with my app. Not sure if OSX is sandboxing calls if the tsserver is started from within an application package.

@rchl
Copy link
Member

rchl commented Nov 5, 2023

The client should open the file (in the LSP sense) first. It doesn't seem like it's doing that from the log file.
Also not sure what 'nvim-x' is.

@hinell
Copy link

hinell commented Nov 5, 2023

@rchl Sorry, for bothering. It turned out that LunarVim/bigfile.nvim plugin was involved. The issue arises if LSP client is detached from and editor buffer on big files. That plugin was doing that all the time.

It's fixed by disabling the said plugin in config.

Has nothing to do with this repo.

@rchl
Copy link
Member

rchl commented Nov 13, 2023

I don't know what this issue is about and there is not enough info to understand it.

If it's still an issue and someone cares about it then please provide TSSERVER logs (initializationOptions.tsserver.logVerbosity: 'verbose').

@rchl rchl closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 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

No branches or pull requests

4 participants