Failed to install: node-red-contrib-modbus

Dear colleagues. I am starting node-red with ubuntu and I have the following problem. I have installed it on ubuntu, and it runs on localhost: 1880. It runs directly when Linux starts. The problem I have had when trying to load node-red-contrib-modbus. It gives me the following error

Failed to install: node-red-contrib-modbus

Install failed Check the log for more information

Later I have installed it with npm from the ubuntu terminal. I think I have done it in the correct directory, (node_modules), but it still does not appear on the palette. If it seems that it is loaded as we see in the screenshot.

Captura de pantalla de 2021-05-21 20-26-01
021-05-21T18:15:59.517Z Install : node-red-contrib-modbus 5.14.0

2021-05-21T18:15:59.520Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-modbus@5.14.0
2021-05-21T18:16:13.060Z [out]
2021-05-21T18:16:13.060Z [out] > @serialport/bindings@9.0.7 install /root/snap/node-red/675/node_modules/@serialport/bindings
2021-05-21T18:16:13.060Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-05-21T18:16:13.060Z [out]
2021-05-21T18:16:13.295Z [err] prebuild-install
2021-05-21T18:16:13.295Z [err]
2021-05-21T18:16:13.295Z [err] WARN
2021-05-21T18:16:13.295Z [err] install
2021-05-21T18:16:13.295Z [err] EPERM: operation not permitted, lchown '/root/snap/node-red/675/node_modules/@serialport/bindings/build/Release'
2021-05-21T18:16:14.192Z [err] gyp
2021-05-21T18:16:14.192Z [err]
2021-05-21T18:16:14.192Z [err] ERR! build error
2021-05-21T18:16:14.193Z [err] gyp ERR! stack Error: not found: make
2021-05-21T18:16:14.193Z [err] gyp ERR! stack
2021-05-21T18:16:14.193Z [err] at getNotFoundError (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:13:12)
2021-05-21T18:16:14.193Z [err] gyp
2021-05-21T18:16:14.193Z [err] ERR! stack
2021-05-21T18:16:14.193Z [err] at F (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:68:19)
2021-05-21T18:16:14.193Z [err] gyp
2021-05-21T18:16:14.193Z [err] ERR!
2021-05-21T18:16:14.193Z [err] stack at E (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:80:29)
2021-05-21T18:16:14.193Z [err] gyp ERR!
2021-05-21T18:16:14.193Z [err] stack
2021-05-21T18:16:14.193Z [err] at /snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:89:16
2021-05-21T18:16:14.193Z [err] gyp
2021-05-21T18:16:14.193Z [err] ERR!
2021-05-21T18:16:14.193Z [err] stack at /snap/node-red/675/lib/node_modules/npm/node_modules/isexe/index.js:42:5
2021-05-21T18:16:14.193Z [err] gyp
2021-05-21T18:16:14.193Z [err] ERR!
2021-05-21T18:16:14.193Z [err] stack at /snap/node-red/675/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
2021-05-21T18:16:14.193Z [err] gyp
2021-05-21T18:16:14.193Z [err] ERR!
2021-05-21T18:16:14.193Z [err] stack at FSReqWrap.oncomplete (fs.js:153:21)
2021-05-21T18:16:14.194Z [err] gyp
2021-05-21T18:16:14.194Z [err] ERR!
2021-05-21T18:16:14.194Z [err] System Linux 5.8.0-53-generic
2021-05-21T18:16:14.194Z [err] gyp
2021-05-21T18:16:14.194Z [err] ERR!
2021-05-21T18:16:14.194Z [err] command
2021-05-21T18:16:14.194Z [err] "/snap/node-red/675/bin/node" "/snap/node-red/675/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2021-05-21T18:16:14.194Z [err] gyp
2021-05-21T18:16:14.194Z [err] ERR!
2021-05-21T18:16:14.194Z [err] cwd /root/snap/node-red/675/node_modules/@serialport/bindings
2021-05-21T18:16:14.194Z [err] gyp
2021-05-21T18:16:14.194Z [err] ERR!
2021-05-21T18:16:14.194Z [err] node -v v10.23.3
2021-05-21T18:16:14.194Z [err] gyp
2021-05-21T18:16:14.194Z [err] ERR! node-gyp -v v5.1.0
2021-05-21T18:16:14.194Z [err] gyp
2021-05-21T18:16:14.194Z [err] ERR!
2021-05-21T18:16:14.194Z [err] not ok
2021-05-21T18:16:14.551Z [err] npm
2021-05-21T18:16:14.551Z [err] ERR! code ELIFECYCLE
2021-05-21T18:16:14.551Z [err] npm
2021-05-21T18:16:14.552Z [err] ERR! errno 1
2021-05-21T18:16:14.559Z [err] npm
2021-05-21T18:16:14.560Z [err] ERR! @serialport/bindings@9.0.7 install: prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-05-21T18:16:14.560Z [err] npm ERR!
2021-05-21T18:16:14.560Z [err] Exit status 1
2021-05-21T18:16:14.560Z [err] npm
2021-05-21T18:16:14.560Z [err] ERR!
2021-05-21T18:16:14.560Z [err]
2021-05-21T18:16:14.560Z [err] npm
2021-05-21T18:16:14.560Z [err] ERR!
2021-05-21T18:16:14.560Z [err] Failed at the @serialport/bindings@9.0.7 install script.
2021-05-21T18:16:14.560Z [err] npm
2021-05-21T18:16:14.561Z [err] ERR!
2021-05-21T18:16:14.561Z [err] This is probably not a problem with npm. There is likely additional logging output above.
2021-05-21T18:16:14.624Z [err]
2021-05-21T18:16:14.624Z [err] npm ERR! A complete log of this run can be found in:
2021-05-21T18:16:14.624Z [err] npm ERR!
2021-05-21T18:16:14.624Z [err] /root/snap/node-red/675/.npm/_logs/2021-05-21T18_16_14_580Z-debug.log
2021-05-21T18:16:14.655Z rc=1

Someone has a solution

Are you using a snap install of node-red? If so is there a reason for using that rather than the recommended method for Ubuntu, Raspbian and other Debian derivatives?

That is not the correct folder, though I can't say which is the correct folder other than it should be the one where you flows and settings files are. If you start node-red in a terminal the startup log will tell you where that is. If you have used the recommended install method it will be ~/.node-red

Thanks for your reply. I used npm as described in the link.

https://nodered.org/docs/getting-started/local

OK, you can install it yourself if you want (note that at the top of that page is the link to the Ubuntu install).
Stop node-red and start it again in a terminal please and post the log here. When pasting it in use the </> button at the top of the forum entry window.

This is what comes out when starting node-red from the terminal. It stays activated even if I close the terminal.

santos@tecnoce:~$ node-red
21 May 22:49:52 - [info]

Welcome to Node-RED

21 May 22:49:52 - [info] Node-RED version: v1.3.5
21 May 22:49:52 - [info] Node.js version: v10.19.0
21 May 22:49:52 - [info] Linux 5.8.0-53-generic x64 LE
21 May 22:49:53 - [info] Loading palette nodes
21 May 22:49:53 - [info] Settings file : /home/santos/.node-red/settings.js
21 May 22:49:53 - [info] Context store : 'default' [module=memory]
21 May 22:49:53 - [info] User directory : /home/santos/.node-red
21 May 22:49:53 - [warn] Projects disabled : editorTheme.projects.enabled=false
21 May 22:49:53 - [info] Flows file : /home/santos/.node-red/flows_tecnoce.json
21 May 22:49:53 - [info] Creating new flow file
21 May 22:49:53 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

21 May 22:49:53 - [error] Unable to listen on http://127.0.0.1:1880/
21 May 22:49:53 - [error] Error: port in use

That is probably because you already have node-red running.

That tells us you need to be in that folder if you want to install a node using npm from the command line.

Yes, node-red is always running, even if I close the terminal. Before, I worked with windows and that didn't happen, I had to run node-red every time I started the computer.

If you installed the usual scripts then you can stop and start using
node-red-stop
node-red-start

If you do install a node from the command line you need to restart node-red before it will see the new nodes.

When I type node-red-stop it tells me that it cannot find the command.

That is because you did not use the recommended script, which would install the commands for you. You can still run that script now if you want, it should add the stuff you have not installed yourself.

Thanks, I hadn't installed the scripts. I am doing it minus this command which does not work.

I am literally typing it in the console, but I don't know if anything else is necessary.

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

What happens when you run it? Have you installed curl?
Also see the prerequisites section on the page.

Good Morning. Thanks for your interest. I think I know where the problems are. I uninstalled node-red. But then I have realized that ubuntu has it integrated. With node-red uninstalled it works the same on localhost
http://localhost:1880/#flow/41328911.f504f8

That is why it gave me the error of the port has occupied. Nodes can be installed here but it does not allow modbus nodes, which is where I detected the problem initially.

I paste the error log again when trying to install node-red-contribution-modbus

36:59.728Z Install : node-red-contrib-modbus 5.14.0

2021-05-22T09:36:59.799Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-modbus@5.14.0
2021-05-22T09:37:11.636Z [out]
2021-05-22T09:37:11.636Z [out] > @serialport/bindings@9.0.7 install /root/snap/node-red/675/node_modules/@serialport/bindings
2021-05-22T09:37:11.636Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-05-22T09:37:11.636Z [out]
2021-05-22T09:37:11.929Z [err] prebuild-install
2021-05-22T09:37:11.929Z [err] WARN install EPERM: operation not permitted, lchown '/root/snap/node-red/675/node_modules/@serialport/bindings/build/Release'
2021-05-22T09:37:13.373Z [err] gyp
2021-05-22T09:37:13.373Z [err]
2021-05-22T09:37:13.373Z [err] ERR!
2021-05-22T09:37:13.373Z [err] build error
2021-05-22T09:37:13.373Z [err] gyp ERR!
2021-05-22T09:37:13.373Z [err] stack Error: not found: make
2021-05-22T09:37:13.373Z [err] gyp
2021-05-22T09:37:13.373Z [err] ERR! stack
2021-05-22T09:37:13.373Z [err] at getNotFoundError (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:13:12)
2021-05-22T09:37:13.373Z [err] gyp
2021-05-22T09:37:13.373Z [err] ERR! stack at F (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:68:19)
2021-05-22T09:37:13.373Z [err] gyp ERR! stack
2021-05-22T09:37:13.373Z [err] at E (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:80:29)
2021-05-22T09:37:13.373Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! stack
2021-05-22T09:37:13.374Z [err] at /snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:89:16
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! stack
2021-05-22T09:37:13.374Z [err] at /snap/node-red/675/lib/node_modules/npm/node_modules/isexe/index.js:42:5
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR!
2021-05-22T09:37:13.374Z [err] stack at /snap/node-red/675/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! stack
2021-05-22T09:37:13.374Z [err] at FSReqWrap.oncomplete (fs.js:153:21)
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! System Linux 5.8.0-53-generic
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! command
2021-05-22T09:37:13.374Z [err] "/snap/node-red/675/bin/node" "/snap/node-red/675/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2021-05-22T09:37:13.374Z [err] gyp ERR!
2021-05-22T09:37:13.374Z [err] cwd /root/snap/node-red/675/node_modules/@serialport/bindings
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! node -v
2021-05-22T09:37:13.374Z [err] v10.23.3
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR! node-gyp -v
2021-05-22T09:37:13.374Z [err] v5.1.0
2021-05-22T09:37:13.374Z [err] gyp
2021-05-22T09:37:13.374Z [err] ERR!
2021-05-22T09:37:13.375Z [err] not ok
2021-05-22T09:37:13.701Z [err] npm
2021-05-22T09:37:13.701Z [err] ERR! code ELIFECYCLE
2021-05-22T09:37:13.703Z [err] npm
2021-05-22T09:37:13.703Z [err] ERR!
2021-05-22T09:37:13.703Z [err] errno 1
2021-05-22T09:37:13.712Z [err] npm ERR!
2021-05-22T09:37:13.712Z [err] @serialport/bindings@9.0.7 install: prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-05-22T09:37:13.712Z [err] npm ERR! Exit status 1
2021-05-22T09:37:13.712Z [err] npm ERR!
2021-05-22T09:37:13.712Z [err]
2021-05-22T09:37:13.712Z [err] npm ERR!
2021-05-22T09:37:13.712Z [err] Failed at the @serialport/bindings@9.0.7 install script.
2021-05-22T09:37:13.712Z [err] npm ERR!
2021-05-22T09:37:13.712Z [err] This is probably not a problem with npm. There is likely additional logging output above.
2021-05-22T09:37:13.782Z [err]
2021-05-22T09:37:13.783Z [err] npm ERR! A complete log of this run can be found in:
2021-05-22T09:37:13.783Z [err] npm ERR!
2021-05-22T09:37:13.783Z [err] /root/snap/node-red/675/.npm/_logs/2021-05-22T09_37_13_723Z-debug.log
2021-05-22T09:37:13.797Z rc=1


2021-05-22T09:52:14.345Z Install : node-red-contrib-modbus 5.14.0

2021-05-22T09:52:14.361Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-modbus@5.14.0
2021-05-22T09:52:18.644Z [out]
2021-05-22T09:52:18.644Z [out] > @serialport/bindings@9.0.7 install /root/snap/node-red/675/node_modules/@serialport/bindings
2021-05-22T09:52:18.644Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-05-22T09:52:18.644Z [out]
2021-05-22T09:52:18.867Z [err] prebuild-install
2021-05-22T09:52:18.867Z [err] WARN
2021-05-22T09:52:18.867Z [err] install EPERM: operation not permitted, lchown '/root/snap/node-red/675/node_modules/@serialport/bindings/build/Release'
2021-05-22T09:52:19.688Z [err] gyp
2021-05-22T09:52:19.688Z [err]
2021-05-22T09:52:19.688Z [err] ERR! build error
2021-05-22T09:52:19.689Z [err] gyp
2021-05-22T09:52:19.689Z [err] ERR! stack Error: not found: make
2021-05-22T09:52:19.689Z [err] gyp ERR!
2021-05-22T09:52:19.689Z [err] stack at getNotFoundError (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:13:12)
2021-05-22T09:52:19.689Z [err] gyp ERR!
2021-05-22T09:52:19.689Z [err] stack at F (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:68:19)
2021-05-22T09:52:19.689Z [err] gyp
2021-05-22T09:52:19.689Z [err] ERR! stack
2021-05-22T09:52:19.689Z [err] at E (/snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:80:29)
2021-05-22T09:52:19.689Z [err] gyp
2021-05-22T09:52:19.689Z [err] ERR! stack
2021-05-22T09:52:19.689Z [err] at /snap/node-red/675/lib/node_modules/npm/node_modules/which/which.js:89:16
2021-05-22T09:52:19.689Z [err] gyp
2021-05-22T09:52:19.690Z [err] ERR! stack
2021-05-22T09:52:19.690Z [err] at /snap/node-red/675/lib/node_modules/npm/node_modules/isexe/index.js:42:5
2021-05-22T09:52:19.690Z [err] gyp
2021-05-22T09:52:19.690Z [err] ERR! stack
2021-05-22T09:52:19.690Z [err] at /snap/node-red/675/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
2021-05-22T09:52:19.690Z [err] gyp
2021-05-22T09:52:19.690Z [err] ERR! stack
2021-05-22T09:52:19.690Z [err] at FSReqWrap.oncomplete (fs.js:153:21)
2021-05-22T09:52:19.690Z [err] gyp
2021-05-22T09:52:19.690Z [err] ERR! System
2021-05-22T09:52:19.690Z [err] Linux 5.8.0-53-generic
2021-05-22T09:52:19.690Z [err] gyp
2021-05-22T09:52:19.690Z [err] ERR!
2021-05-22T09:52:19.690Z [err] command
2021-05-22T09:52:19.690Z [err] "/snap/node-red/675/bin/node" "/snap/node-red/675/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2021-05-22T09:52:19.690Z [err] gyp
2021-05-22T09:52:19.690Z [err] ERR!
2021-05-22T09:52:19.690Z [err] cwd
2021-05-22T09:52:19.691Z [err] /root/snap/node-red/675/node_modules/@serialport/bindings
2021-05-22T09:52:19.691Z [err] gyp
2021-05-22T09:52:19.691Z [err] ERR!
2021-05-22T09:52:19.691Z [err] node -v
2021-05-22T09:52:19.691Z [err] v10.23.3
2021-05-22T09:52:19.691Z [err] gyp
2021-05-22T09:52:19.691Z [err] ERR!
2021-05-22T09:52:19.691Z [err] node-gyp -v v5.1.0
2021-05-22T09:52:19.691Z [err] gyp
2021-05-22T09:52:19.691Z [err] ERR!
2021-05-22T09:52:19.691Z [err] not ok
2021-05-22T09:52:19.691Z [err]
2021-05-22T09:52:19.947Z [err] npm
2021-05-22T09:52:19.947Z [err] ERR! code ELIFECYCLE
2021-05-22T09:52:19.947Z [err] npm ERR!
2021-05-22T09:52:19.947Z [err] errno 1
2021-05-22T09:52:19.949Z [err] npm
2021-05-22T09:52:19.949Z [err] ERR! @serialport/bindings@9.0.7 install: prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-05-22T09:52:19.949Z [err] npm
2021-05-22T09:52:19.950Z [err] ERR! Exit status 1
2021-05-22T09:52:19.950Z [err] npm ERR!
2021-05-22T09:52:19.950Z [err]
2021-05-22T09:52:19.950Z [err] npm ERR!
2021-05-22T09:52:19.950Z [err] Failed at the @serialport/bindings@9.0.7 install script.
2021-05-22T09:52:19.950Z [err] npm
2021-05-22T09:52:19.950Z [err] ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-05-22T09:52:19.999Z [err]
2021-05-22T09:52:19.999Z [err] npm ERR! A complete log of this run can be found in:
2021-05-22T09:52:19.999Z [err] npm ERR!
2021-05-22T09:52:19.999Z [err] /root/snap/node-red/675/.npm/_logs/2021-05-22T09_52_19_957Z-debug.log
2021-05-22T09:52:20.010Z rc=1

Running the script would have uninstalled the original node-red. Have you managed to run it yet? If not then do these commands work?
ping raw.githubusercontent.com
curl https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered
The latter should download and show the script contents.

Running ping gives the following

@tecnoce:~/node_modules$ ping raw.githubusercontent.com
PING raw.githubusercontent.com (185.199.111.133) 56(84) bytes of data.
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=1 ttl=57 time=15.8 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=2 ttl=57 time=17.2 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=3 ttl=57 time=38.6 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=4 ttl=57 time=17.8 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=5 ttl=57 time=16.6 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=6 ttl=57 time=17.6 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=7 ttl=57 time=30.7 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=8 ttl=57 time=38.2 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=9 ttl=57 time=16.7 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=10 ttl=57 time=16.5 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=11 ttl=57 time=16.3 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=12 ttl=57 time=16.9 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=13 ttl=57 time=47.6 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=14 ttl=57 time=16.7 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=15 ttl=57 time=18.0 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=16 ttl=57 time=83.6 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=17 ttl=57 time=25.3 ms
64 bytes from cdn-185-199-111-133.github.com (185.199.111.133): icmp_seq=18 ttl=57 time=44.8 ms
64 bytes from cdn-185-199-111-133.github.com (

OK, that shows you can access the server. Does the curl command work?

I've used the curl command like this but it doesn't work.

bash <(curl -sl://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

When you uninstalled. You did uninstall the snap version didn’t you ? From the log above it looks like it’s still the running one

I'm checking. I uninstalled sap and have also uninstalled nodejs. However node-red still works on localhost. I get the impression that it is another version built into the ubuntu system.

So you did

sudo snap remove node-red