reddit / emacs

Starting pyright without internet

TheHentaiSama · 2022-06-05 10:07
Hello everyone ! I am using doom emacs with lsp and pyright for my python projects and everything works quite well. Yesterday however, I noticed that when lsp started with pyright without any internet connection, pyright would simply refuse to start. When checking the pyright::stderr buffer, I got the following : npm ERR! code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR! request to https://registry.npmjs.org/pyright failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org npm ERR! A complete log of this run can be found in: npm ERR! /home/gautier/.npm/_logs/2022-06-05T09_55_34_647Z-debug.log Traceback (most recent call last): File "/home/gautier/.pyenv/versions/venv/bin/pyright-langserver", line 8, in <module> sys.exit(entrypoint()) File "/home/gautier/.pyenv/versions/venv/lib64/python3.9/site-packages/pyright/langserver.py", line 57, in entrypoint sys.exit(main(*sys.argv[1:])) File "/home/gautier/.pyenv/versions/venv/lib64/python3.9/site-packages/pyright/langserver.py", line 26, in main return run(*args, **kwargs).returncode File "/home/gautier/.pyenv/versions/venv/lib64/python3.9/site-packages/pyright/langserver.py", line 37, in run version = node.latest('pyright') File "/home/gautier/.pyenv/versions/venv/lib64/python3.9/site-packages/pyright/node.py", line 145, in latest raise errors.VersionCheckFailed( pyright.errors.VersionCheckFailed: Version check for pyright failed, see output above. Process pyright stderr finished npm ERR! code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR! request to https://registry.npmjs.org/pyright failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org From what I understand, npm is trying to check the version of pyright but since I don't have an internet connection, it simply fails. Is there a way to skip this verification step and start pyright anyway ? I must admit that I still don't fully understand how lsp works so there might be something simple that I'm missing here. Thanks in advance =)
Qwarctick · 2022-06-06 08:15
I suppose you don't have pyrigth installed. So the lsp-mode tried to install it. But without internet connection it failed. You should run : sudo npm install -g pyright
TheHentaiSama · 2022-06-06 11:05
Nope it is already installed via npm ! That’s what’s making me think that it’s trying to check if there is an update
Qwarctick · 2022-06-06 15:03
Ok, then, what is the message in your \*message\* buffer ?