Docker npm installs wrong dependency version


#1

Hi All,
I want to install the Node Red Node Modbus on build with this command:

RUN apk add --no-cache make gcc g++ python && \
  JOBS=MAX npm install -g node-red-contrib-modbus --production --silent && \
  apk del make gcc g++ python && \
  npm cache clean --force && rm -rf /tmp/*

But the problem is it is installing the dependency 6.1.0 of node-serialport and that version has an alpine error. See log:

[34m[Build]   [39m [91mprebuild-install[0m[91m [0m[91minfo[0m[91m [0m[91mbegin Prebuild-install version 2.5.1
[34m[Build]   [39m [0m[91mprebuild-install info [0m[91mlooking for local prebuild @ prebuilds/serialport-v6.1.0-node-v59-linuxmusl-arm.tar.gz
[34m[Build]   [39m [0m[91mprebuild-install info [0m[91mlooking for cached prebuild @[0m[91m /root/.npm/_prebuilds/https-github.com-node-serialport-node-serialport-releases-download-v6.1.0-serialport-v6.1.0-node-v59-linuxmusl-arm.tar.gz
[34m[Build]   [39m [0m[91mprebuild-install http [0m[91mrequest[0m[91m GET https://github.com/node-serialport/node-serialport/releases/download/v6.1.0/serialport-v6.1.0-node-v59-linuxmusl-arm.tar.gz
[34m[Build]   [39m [0m[91mprebuild-install http [0m[91m404 https://github.com/node-serialport/node-serialport/releases/download/v6.1.0/serialport-v6.1.0-node-v59-linuxmusl-arm.tar.gz
[34m[Build]   [39m [0m[91mprebuild-install WARN [0m[91minstall No prebuilt binaries found (target=9.4.0 runtime=node arch=arm platform=linux)
[34m[Build]   [39m [0mmake: Entering directory '/usr/local/lib/node_modules/node-red-contrib-modbus/node_modules/node-modbus/node_modules/serialport/build'
[34m[Build]   [39m   CXX(target) Release/obj.target/serialport/src/serialport.o
[34m[Build]   [39m   CXX(target) Release/obj.target/serialport/src/serialport_unix.o
[34m[Build]   [39m   CXX(target) Release/obj.target/serialport/src/poller.o
[34m[Build]   [39m   CXX(target) Release/obj.target/serialport/src/serialport_linux.o
[34m[Build]   [39m [91m../src/serialport_linux.cpp: In function 'int linuxSetCustomBaudRate(int, unsigned int)':
[34m[Build]   [39m ../src/serialport_linux.cpp:10:18: error: 'TCGETS2' was not declared in this scope
[34m[Build]   [39m      if(ioctl(fd, TCGETS2, &t)) {
[34m[Build]   [39m                   ^~~~~~~
[34m[Build]   [39m ../src/serialport_linux.cpp:18:18: error: 'TCSETS2' was not declared in this scope
[34m[Build]   [39m      if(ioctl(fd, TCSETS2, &t)) {
[34m[Build]   [39m                   ^~~~~~~
[34m[Build]   [39m [0m[91m../src/serialport_linux.cpp: In function 'int linuxGetSystemBaudRate(int, int*)':
[34m[Build]   [39m ../src/serialport_linux.cpp:29:16: error: 'TCGETS2' was not declared in this scope
[34m[Build]   [39m    if(ioctl(fd, TCGETS2, &t)) {
[34m[Build]   [39m                 ^~~~~~~
[34m[Build]   [39m [0m[91mmake: *** [serialport.target.mk:96: Release/obj.target/serialport/src/serialport_linux.o] Error 1
[34m[Build]   [39m make: *** Waiting for unfinished jobs....
[34m[Build]   [39m [0mmake: Leaving directory '/usr/local/lib/node_modules/node-red-contrib-modbus/node_modules/node-modbus/node_modules/serialport/build'
[34m[Build]   [39m Removing intermediate container 900c23756188

Now the developer has changed the dependency to 6.0.5 (https://github.com/biancode/node-red-contrib-modbus/blob/56f2e576281bd30ed01a9ca5a40605335423fa0f/package.json#L12) but the docker builder keeps getting the 6.1.0 version on build. Insted of the linked dependency of 6.0.5 what would be the correct version.

How can i achieve the docker builder to get the correct dependency version? Is it somehow cached?


#4

Seems the problem was another dependency using the 6.1.0 version.
This can be closed.


#5

Thanks for reporting back your findings :+1:
This could be useful for the rest of the community.