pyright-python icon indicating copy to clipboard operation
pyright-python copied to clipboard

Support custom nodeenv options

Open ultmaster opened this issue 3 years ago • 3 comments

This is transferred from microsoft/pyright#3414. Possibly related to #56.

pyright crashes with the following error after node 18 has been released.

> pyright myproject
 * Install prebuilt node (18.0.0) ..... done.
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)

I'm running ubuntu 18.04. There seems to be no obvious (/convenient) way to upgrade my glibc 2.27 to 2.28. After a little digging, I found that pyright is using nodeenv to create a clean node environment under /tmp/pyright.username, and nodeenv automatically looks for latest stable. Unfortunately, although nodeenv provides way to restrain the node version, pyright didn't expose such ability.

A possible solution is to constrain the node versions in pyright. I did that by hacking pyright's python package.

def _install_node_env() -> None:
    log.debug('Installing nodeenv to %s', ENV_DIR)
    args = [sys.executable, '-m', 'nodeenv', str(ENV_DIR), '--node=16.15.0']  # I added node version here
    log.debug('Running command with args: %s', args)
    subprocess.run(args, check=True)

I was hoping that pyright could address that natively.

ultmaster avatar May 03 '22 00:05 ultmaster

Thanks for the report.

The solution that I can see here is to support passing arguments to nodeenv.

RobertCraigie avatar May 04 '22 14:05 RobertCraigie

We're also running into this issue, would appreciate a fix!

frg100 avatar Aug 05 '22 21:08 frg100

Yup, running into this issue as well.

kevinsqi avatar Oct 03 '22 17:10 kevinsqi