Installation error on Ubuntu Desktop 18.04.5 LTS using npm

Hi,

I am trying to install Serverless locally by running

$ npm install serverless

but I got this error

npm ERR! code 1
npm ERR! path /home/elia/projects/aws-experiments/serverless-framework-hello-world/node_modules/serverless
npm ERR! command failed
npm ERR! command sh -c node ./scripts/postinstall.js

I am using Node.js 14.16.0 and npm 7.5.6 (snap).
I found this forum post Error Installing serverless using NPM on ubuntu 20.04 Desktop but the suggested solution does not work in my case.

Any hint?

Thank you
Elia

Here a follow up,

the problem was that I installed Node.js and npm through snap and there were issues with paths.

So I removed the Node.js snap

$ sudo snap remove node

I installed nvm and then the last Node.js LTS

nvm install --lts

Opened another terminal and updated npm

npm install -g npm

and finally

npm install -g serverless