Ok.
I've resolved it with this order to install:
sudo npm install serialport --unsafe-perm --build-from-source
as the serialport web page says:
https://www.npmjs.com/package/serialport
Thanks for all!
Answer from peripecio on Stack Overflow
» npm install serialport
Update your nodejs
npm WARN engine [email protected]: wanted: {"node":">=8.6.0"} (current: {"node":"4.9.1","npm":"2.15.11"})
your current version do not understand ES6 syntax
const { hostname, port, protocol, auth, path } = url.parse(opts.url) ^ SyntaxError: Unexpected token {
I had a similar problem. My solution: I got more specific about which version of nodejs I was using. I had the latest release (at this writing) 13.8 and I had the same problems as the OP.
So I installed nvm and started using it to pick my nodejs.
$ nvm install --lts
$ nvm use --lts
Now using node v12.16.0
The current Long Term Support version (at this writing) is 12.6. I redid npm install for the app and after that I had no problems with the serial port. Theoretically, I could have kept nvm'installing different version of nodejs until I got the one that worked.
» npm install serialport-v4
» npm install node-red-node-serialport
» npm install serialport-gsm
» npm install @cutii/serialport
» npm install serialport-v5
» npm install serialport-js