Errors related to sqlite when migrating from docker image 2.2.2-16 to 3.0.2-16

My dockerfile works fine when using image nodered/node-red:2.2.2-16 but when changing to nodered/node-red:3.0.2-16 the build failed.

FYI successful build output when using image nodered/node-red:2.2.2-16:

Step 3/16 : RUN set -ex && apk --no-cache add sudo sqlite exiftool
 ---> Running in a7b5a2da7d9e
+ apk --no-cache add sudo sqlite exiftool
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/5) Installing perl (5.30.3-r0)
(2/5) Installing perl-image-exiftool (11.99-r0)
(3/5) Installing exiftool (11.99-r0)
(4/5) Installing sqlite (3.32.1-r1)
(5/5) Installing sudo (1.9.5p2-r0)
Executing busybox-1.31.1-r21.trigger
OK: 380 MiB in 72 packages
Removing intermediate container a7b5a2da7d9e
 ---> b4eace34d3b2
Step 4/16 : RUN echo "node-red ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
 ---> Running in c70af9c7dc56
Removing intermediate container c70af9c7dc56
 ---> de0dbff0d2c5
Step 5/16 : RUN echo "Set disable_coredump false" >> /etc/sudo.conf
 ---> Running in 0daa37379e53
Removing intermediate container 0daa37379e53
 ---> 811b6c702f8b
Step 6/16 : RUN mkdir                   /remote
 ---> Running in 2a370ad81f5d
Removing intermediate container 2a370ad81f5d
 ---> c3c2c0023ae3
Step 7/16 : RUN chown node-red:node-red /remote
 ---> Running in 638f550fb1aa
Removing intermediate container 638f550fb1aa
 ---> acee8ab3e5d7
Step 8/16 : RUN mkdir /node-red
 ---> Running in 542e9437af2b
Removing intermediate container 542e9437af2b
 ---> 16f434b1f98d
Step 9/16 : RUN chown node-red:node-red /node-red
 ---> Running in cbdd41878fb3
Removing intermediate container cbdd41878fb3
 ---> f87df35fec0e
Step 10/16 : USER node-red
 ---> Running in d26a33a9ebc8
Removing intermediate container d26a33a9ebc8
 ---> 87d523178bc7
Step 11/16 : COPY --chown=node-red:node-red  package.json /node-red/
 ---> a8197293dad1
Step 12/16 : RUN  cd /node-red ; npm install --unsafe-perm --no-update-notifier --no-fund --only=production
 ---> Running in d1ac89dc84ce
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

added 124 packages, and audited 125 packages in 4m

found 0 vulnerabilities
Removing intermediate container d1ac89dc84ce
 ---> b338b91e1b4e
Step 13/16 : COPY --chown=node-red:node-red flows.json flows_cred.json settings.js /node-red/
 ---> 0fae54f4a3ce

and this is what I get when changing to nodered/node-red:3.0.2-16

Status: Downloaded newer image for nodered/node-red:3.0.2-16
 ---> a15fc0f4e930
Step 2/16 : USER root
 ---> Running in 3991cc5234e3
Removing intermediate container 3991cc5234e3
 ---> e6be7a2e86f3
Step 3/16 : RUN set -ex && apk --no-cache add sudo sqlite exiftool
 ---> Running in a398b431ecef
+ apk --no-cache add sudo sqlite exiftool
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/8) Installing perl (5.34.1-r0)
(2/8) Installing perl-image-exiftool (12.40-r0)
(3/8) Installing exiftool (12.40-r0)
(4/8) Installing perl-error (0.17029-r1)
(5/8) Installing perl-git (2.36.2-r0)
(6/8) Installing git-perl (2.36.2-r0)
(7/8) Installing sqlite (3.38.5-r0)
(8/8) Installing sudo (1.9.10-r0)
Executing busybox-1.35.0-r15.trigger
OK: 325 MiB in 77 packages
Removing intermediate container a398b431ecef
 ---> 8054e02a62e0
Step 4/16 : RUN echo "node-red ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
 ---> Running in 1830c108eda1
Removing intermediate container 1830c108eda1
 ---> ab127c044e49
Step 5/16 : RUN echo "Set disable_coredump false" >> /etc/sudo.conf
 ---> Running in d9d54f105742
Removing intermediate container d9d54f105742
 ---> 7f43c60ceb3f
Step 6/16 : RUN mkdir                   /remote
 ---> Running in dbff312b67ea
Removing intermediate container dbff312b67ea
 ---> ccabbbfd2908
Step 7/16 : RUN chown node-red:node-red /remote
 ---> Running in 8b360fad1950
Removing intermediate container 8b360fad1950
 ---> 05871d5b0ed8
Step 8/16 : RUN mkdir /node-red
 ---> Running in 5345facdfbcf
Removing intermediate container 5345facdfbcf
 ---> 1ffd0f505ca2
Step 9/16 : RUN chown node-red:node-red /node-red
 ---> Running in 370fa48a3239
Removing intermediate container 370fa48a3239
 ---> 26056939c4d4
Step 10/16 : USER node-red
 ---> Running in adb981def21f
Removing intermediate container adb981def21f
 ---> 92cdc7f21d3f
Step 11/16 : COPY --chown=node-red:node-red  package.json /node-red/
 ---> 1703189f4e95
Step 12/16 : RUN  cd /node-red ; npm install --unsafe-perm --no-update-notifier --no-fund --only=production
 ---> Running in 5ab17b47fca2
npm WARN config only Use `--omit=dev` to omit dev dependencies from the install.
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm ERR! code 1
npm ERR! path /node-red/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! make: Entering directory '/node-red/node_modules/sqlite3/build'
npm ERR!   ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c
npm ERR! make: Leaving directory '/node-red/node_modules/sqlite3/build'
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.11.0
npm ERR! node-pre-gyp info using node@16.16.0 | linux | x64
npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download 
npm ERR! node-pre-gyp info check checked for "/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64/node_sqlite3.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-linux-x64.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-linux-x64.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-linux-x64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.2.0 and node@16.16.0 (node-v93 ABI, musl) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-linux-x64.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | linux | x64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.5 found at "/usr/bin/python3"
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.16.0/SHASUMS256.txt
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.16.0/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/node-red/node_modules/sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/src/node-red/.cache/node-gyp/16.16.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/usr/src/node-red/.cache/node-gyp/16.16.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/usr/src/node-red/.cache/node-gyp/16.16.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/node-red/node_modules/sqlite3',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | linux | x64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! /bin/sh: python: not found
npm ERR! make: *** [deps/action_before_build.target.mk:13: Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c] Error 127
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.15.0-46-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
npm ERR! gyp ERR! cwd /node-red/node_modules/sqlite3
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/node-red/node_modules/sqlite3/lib/binding/node-v93-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Linux 5.15.0-46-generic
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /node-red/node_modules/sqlite3
npm ERR! node-pre-gyp ERR! node -v v16.16.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/.npm/_logs/2022-08-12T15_36_34_899Z-debug-0.log
1 error occurred:
        * Status: The command '/bin/sh -c cd /node-red ; npm install --unsafe-perm --no-update-notifier --no-fund --only=production' returned a non-zero code: 1, Code: 1


make: *** [all] Error 1

The problem might be due to the sqlite node.
FYI here my package.json

{
    "name": "node-red-mydrive-ctrl",
    "description": "Node-RED My-Drive Controller",
    "version": "0.0.1",
    "dependencies": {
        "node-red-node-daemon": "0.2.1",
        "node-red-node-sqlite": "0.6.0",
        "node-red-dashboard": "3.1.6",
        "node-red-contrib-ui-etable": "4.6.3"
    },
    "node-red": {
        "settings": {
            "flowFile": "flows.json",
            "credentialsFile": "flows_cred.json"
        }
    }
}

and here my Dockerfile:

FROM nodered/node-red:3.0.2-16

######### Changing to root as below commands should be run as root #############

USER root

# installing sudo command & sqlite
RUN set -ex && apk --no-cache add sudo sqlite exiftool

# following commands should assure that user node-red can use sudo without requiring to enter a password.
RUN echo "node-red ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# get rid of the sudo error (see https://github.com/sudo-project/sudo/issues/42#issuecomment-609079906)
RUN echo "Set disable_coredump false" >> /etc/sudo.conf

# the WD samba shares will be mounted under folder /remote
RUN mkdir                   /remote
RUN chown node-red:node-red /remote

# creating the Node-RED userDir "/node-red" with proper permissions
RUN mkdir /node-red
RUN chown node-red:node-red /node-red
######### Changing back to node-red user #####################
USER node-red

COPY --chown=node-red:node-red  package.json /node-red/
# The following command will build all the nodes specified in the package.json that is copied
# in previous command.
RUN  cd /node-red ; npm install --unsafe-perm --no-update-notifier --no-fund --only=production

# Copy Node-RED flow files and settings to userDir
COPY --chown=node-red:node-red flows.json flows_cred.json settings.js /node-red/

COPY --chown=node-red:node-red entrypoint.sh rules.json ./

# also Copy settings.js to /data folder as docker healthcheck.js is requiring this.
# see https://discourse.nodered.org/t/node-red-docker-settings-js/26529
COPY settings.js /data/

# the below entrypoint replaces the entrypoint of the nodered/node-red
ENTRYPOINT  ["bash", "entrypoint.sh"]

I am building it on an intel nuc (amd64 architecture)

npm ERR! /bin/sh: python: not found

That's the important bit of the error and entirely expected and mentioned in the release notes

Any reason you are trying to install node-red-node-sqlite 0.6.0 when the latest is 1.0.3?

2 Likes

Thanks,

Using latest version of node-red-node-sqlite (= version 1.0.3) instead of version 0.6.0 fixed it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.