'How to install pyright on ubuntu 20.04?

I want to install pyright on my ubuntu. To do this, I first installed npm (the most recent version):

npm install -g npm@latest

But when I install a pyright, I get these errors:

/home/user/.npm-global/bin/pyright-langserver -> /home/user/.npm-global/lib/node_modules/pyright/langserver.index.js
/home/user/.npm-global/bin/pyright -> /home/user/.npm-global/lib/node_modules/pyright/index.js
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

Can you please tell me if this can be fixed somehow?



Solution 1:[1]

It looks like your NodeJS version is lower than the minimum required version (12.0.0). You need to upgrade NodeJS.

Clear the npm cache: npm cache clean -f

Install Node’s version manager:

npm install -g n

Finally, install the latest stable version

sudo n stable

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 July H.