Node-RED Installation of node-red-node-serialport fails


Running DietPi 8.2.2 with Node-RED 2.2.0 which I installed via dietpi-software, I have the following issue:
Installation of some Nodes like USBHID or serialport via >>pallettes<< fails. It also fails when I try to install it manually via “sudo npm install node-red-node-serialport”.
Now I don’t have any idea, what else I could do that it doesn’t fail anymore.

I know that this is not a node-red forum, but I think the problem is based on some access issues that I see from time to time while using Node-RED on DietPi. Maybe you have some hints for me?

Thanks in advance!

And here’s the logfile output…

0 verbose cli [
0 verbose cli   '/usr/local/bin/node',
0 verbose cli   '/usr/local/bin/npm',
0 verbose cli   'install',
0 verbose cli   '--no-audit',
0 verbose cli   '--no-update-notifier',
0 verbose cli   '--no-fund',
0 verbose cli   '--save',
0 verbose cli   '--save-prefix=~',
0 verbose cli   '--production',
0 verbose cli   '--engine-strict',
0 verbose cli   'node-red-node-serialport@1.0.1'
0 verbose cli ]
1 info using npm@8.5.5
2 info using node@v17.4.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 6ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 3ms
7 verbose config production Use `--omit=dev` instead.
8 timing config:load:cli Completed in 9ms
9 timing config:load:env Completed in 1ms
10 timing config:load:project Completed in 26ms
11 timing config:load:file:/mnt/dietpi_userdata/node-red/.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 3ms
17 timing config:load:setEnvs Completed in 3ms
18 timing config:load Completed in 58ms
19 timing npm:load:configload Completed in 59ms
20 timing npm:load:setTitle Completed in 1ms
21 timing config:load:flatten Completed in 9ms
22 timing npm:load:display Completed in 11ms
23 verbose logfile /mnt/dietpi_userdata/node-red/.npm/_logs/2022-03-29T13_46_59_529Z-debug-0.log
24 timing npm:load:logFile Completed in 15ms
25 timing npm:load:timers Completed in 1ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 90ms
28 timing arborist:ctor Completed in 2ms
29 silly logfile start cleaning logs, removing 1 files
30 timing idealTree:init Completed in 3409ms
31 timing idealTree:userRequests Completed in 10ms
32 silly idealTree buildDeps
33 silly fetch manifest node-red-node-serialport@1.0.1
34 timing arborist:ctor Completed in 1ms
35 http fetch GET 200 3047ms (cache revalidated)
36 silly placeDep ROOT node-red-node-serialport@1.0.1 OK for:  want: 1.0.1
37 silly fetch manifest serialport@^10.3.0
38 http fetch GET 200 93ms (cache revalidated)
39 timing idealTree:#root Completed in 3193ms
40 silly placeDep node_modules/node-red-node-serialport serialport@10.4.0 OK for: node-red-node-serialport@1.0.1 want: ^10.3.0
41 silly fetch manifest @serialport/binding-mock@10.2.2
42 silly fetch manifest @serialport/bindings-cpp@10.7.0
43 silly fetch manifest @serialport/parser-byte-length@10.3.0
44 silly fetch manifest @serialport/parser-cctalk@10.3.0
45 silly fetch manifest @serialport/parser-delimiter@10.3.0
46 silly fetch manifest @serialport/parser-inter-byte-timeout@10.3.0
47 silly fetch manifest @serialport/parser-packet-length@10.3.0
48 silly fetch manifest @serialport/parser-readline@10.3.0
49 silly fetch manifest @serialport/parser-ready@10.3.0
50 silly fetch manifest @serialport/parser-regex@10.3.0
51 silly fetch manifest @serialport/parser-slip-encoder@10.3.0
52 silly fetch manifest @serialport/parser-spacepacket@10.3.0
53 silly fetch manifest @serialport/stream@10.3.0
54 silly fetch manifest debug@^4.3.3
55 http fetch GET 200 263ms (cache revalidated)
56 http fetch GET 200 332ms (cache revalidated)
57 http fetch GET 200 359ms (cache revalidated)
58 http fetch GET 200 364ms (cache revalidated)
59 http fetch GET 200 434ms (cache revalidated)
60 http fetch GET 200 445ms (cache revalidated)
61 http fetch GET 200 453ms (cache revalidated)
62 http fetch GET 200 488ms (cache revalidated)
63 http fetch GET 200 496ms (cache revalidated)
64 http fetch GET 200 719ms (cache revalidated)
65 http fetch GET 200 1223ms (cache revalidated)
66 http fetch GET 200 1625ms (cache revalidated)
67 http fetch GET 200 1659ms (cache revalidated)
68 http fetch GET 200 1730ms (cache revalidated)
69 timing idealTree:node_modules/node-red-node-serialport Completed in 1764ms
70 silly placeDep node_modules/node-red-node-serialport @serialport/binding-mock@10.2.2 OK for: serialport@10.4.0 want: 10.2.2
71 silly placeDep ROOT @serialport/bindings-cpp@10.7.0 OK for: serialport@10.4.0 want: 10.7.0
72 silly placeDep node_modules/node-red-node-serialport @serialport/parser-byte-length@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
73 silly placeDep node_modules/node-red-node-serialport @serialport/parser-cctalk@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
74 silly placeDep node_modules/node-red-node-serialport @serialport/parser-delimiter@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
75 silly placeDep node_modules/node-red-node-serialport @serialport/parser-inter-byte-timeout@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
76 silly placeDep ROOT @serialport/parser-packet-length@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
77 silly placeDep node_modules/node-red-node-serialport @serialport/parser-readline@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
78 silly placeDep node_modules/node-red-node-serialport @serialport/parser-ready@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
79 silly placeDep node_modules/node-red-node-serialport @serialport/parser-regex@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
80 silly placeDep node_modules/node-red-node-serialport @serialport/parser-slip-encoder@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
81 silly placeDep ROOT @serialport/parser-spacepacket@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
82 silly placeDep node_modules/node-red-node-serialport @serialport/stream@10.3.0 OK for: serialport@10.4.0 want: 10.3.0
83 silly placeDep node_modules/node-red-node-serialport debug@4.3.4 OK for: serialport@10.4.0 want: ^4.3.3
84 silly fetch manifest @serialport/bindings-interface@^1.2.1
85 silly fetch manifest @serialport/bindings-interface@1.2.1
86 silly fetch manifest @serialport/parser-readline@^10.2.1
87 silly fetch manifest debug@^4.3.2
88 silly fetch manifest node-addon-api@^4.3.0
89 silly fetch manifest node-gyp-build@^4.3.0
90 silly fetch manifest ms@2.1.2
91 http fetch GET 200 77ms (cache revalidated)
92 http fetch GET 200 81ms (cache revalidated)
93 http fetch GET 200 86ms (cache revalidated)
94 http fetch GET 200 1406ms (cache revalidated)
95 timing idealTree:node_modules/node-red-node-serialport/node_modules/serialport Completed in 1540ms
96 silly placeDep ROOT @serialport/bindings-interface@1.2.1 OK for: @serialport/bindings-cpp@10.7.0 want: 1.2.1
97 silly placeDep node_modules/@serialport/bindings-cpp @serialport/parser-readline@10.3.0 OK for: @serialport/bindings-cpp@10.7.0 want: ^10.2.1
98 silly placeDep node_modules/@serialport/bindings-cpp debug@4.3.4 OK for: @serialport/bindings-cpp@10.7.0 want: ^4.3.2
99 silly placeDep node_modules/@serialport/bindings-cpp node-addon-api@4.3.0 OK for: @serialport/bindings-cpp@10.7.0 want: ^4.3.0
100 silly placeDep ROOT node-gyp-build@4.3.0 OK for: @serialport/bindings-cpp@10.7.0 want: ^4.3.0
101 timing idealTree:node_modules/@serialport/bindings-cpp Completed in 43ms
102 timing idealTree:node_modules/@serialport/bindings-interface Completed in 1ms
103 timing idealTree:node_modules/@serialport/parser-packet-length Completed in 0ms
104 timing idealTree:node_modules/@serialport/parser-spacepacket Completed in 0ms
105 timing idealTree:node_modules/node-gyp-build Completed in 0ms
106 silly placeDep node_modules/@serialport/bindings-cpp @serialport/parser-delimiter@10.3.0 OK for: @serialport/parser-readline@10.3.0 want: 10.3.0
107 timing idealTree:node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-readline Completed in 6ms
108 timing idealTree:node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-delimiter Completed in 0ms
109 silly placeDep node_modules/@serialport/bindings-cpp ms@2.1.2 OK for: debug@4.3.4 want: 2.1.2
110 timing idealTree:node_modules/@serialport/bindings-cpp/node_modules/debug Completed in 5ms
111 timing idealTree:node_modules/@serialport/bindings-cpp/node_modules/ms Completed in 0ms
112 timing idealTree:node_modules/@serialport/bindings-cpp/node_modules/node-addon-api Completed in 0ms
113 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/binding-mock Completed in 0ms
114 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-byte-length Completed in 0ms
115 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-cctalk Completed in 0ms
116 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-delimiter Completed in 0ms
117 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-inter-byte-timeout Completed in 0ms
118 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-readline Completed in 0ms
119 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-ready Completed in 0ms
120 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-regex Completed in 0ms
121 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/parser-slip-encoder Completed in 0ms
122 timing idealTree:node_modules/node-red-node-serialport/node_modules/@serialport/stream Completed in 0ms
123 silly placeDep node_modules/node-red-node-serialport ms@2.1.2 OK for: debug@4.3.4 want: 2.1.2
124 timing idealTree:node_modules/node-red-node-serialport/node_modules/debug Completed in 4ms
125 timing idealTree:node_modules/node-red-node-serialport/node_modules/ms Completed in 0ms
126 timing idealTree:buildDeps Completed in 6572ms
127 timing idealTree:fixDepFlags Completed in 38ms
128 timing idealTree Completed in 10071ms
129 timing reify:loadTrees Completed in 10074ms
130 timing reify:diffTrees Completed in 143ms
131 silly reify moves {}
132 timing reify:retireShallow Completed in 1ms
133 timing reify:createSparse Completed in 19ms
134 timing reify:trashOmits Completed in 4ms
135 timing reify:loadBundles Completed in 0ms
136 verbose reify failed optional dependency /mnt/dietpi_userdata/node-red/node_modules/fsevents
137 silly reify mark deleted [ '/mnt/dietpi_userdata/node-red/node_modules/fsevents' ]
138 timing reifyNode:node_modules/fsevents Completed in 13ms
139 timing reifyNode:node_modules/@serialport/bindings-cpp/node_modules/ms Completed in 327ms
140 timing reifyNode:node_modules/node-red-node-serialport/node_modules/ms Completed in 327ms
141 timing reifyNode:node_modules/@serialport/parser-packet-length Completed in 338ms
142 timing reifyNode:node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-delimiter Completed in 339ms
143 timing reifyNode:node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-readline Completed in 337ms
144 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-regex Completed in 338ms
145 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-ready Completed in 339ms
146 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-inter-byte-timeout Completed in 338ms
147 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-readline Completed in 340ms
148 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-delimiter Completed in 339ms
149 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-cctalk Completed in 339ms
150 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-byte-length Completed in 340ms
151 timing reifyNode:node_modules/node-gyp-build Completed in 348ms
152 timing reifyNode:node_modules/@serialport/bindings-interface Completed in 348ms
153 timing reifyNode:node_modules/@serialport/parser-spacepacket Completed in 348ms
154 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/binding-mock Completed in 345ms
155 timing reifyNode:node_modules/@serialport/bindings-cpp/node_modules/debug Completed in 349ms
156 timing reifyNode:node_modules/node-red-node-serialport/node_modules/debug Completed in 348ms
157 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/stream Completed in 347ms
158 timing reifyNode:node_modules/node-red-node-serialport/node_modules/@serialport/parser-slip-encoder Completed in 349ms
159 timing reifyNode:node_modules/node-red-node-serialport/node_modules/serialport Completed in 350ms
160 timing reifyNode:node_modules/node-red-node-serialport Completed in 363ms
161 timing reifyNode:node_modules/@serialport/bindings-cpp/node_modules/node-addon-api Completed in 378ms
162 timing reifyNode:node_modules/@serialport/bindings-cpp Completed in 430ms
163 timing reify:unpack Completed in 431ms
164 timing reify:unretire Completed in 0ms
165 timing build:queue Completed in 7ms
166 timing build:link:node_modules/node-gyp-build Completed in 4ms
167 timing build:link Completed in 5ms
168 info run @serialport/bindings-cpp@10.7.0 install node_modules/@serialport/bindings-cpp node-gyp-build
169 info run @serialport/bindings-cpp@10.7.0 install { code: 126, signal: null }
170 timing reify:rollback:createSparse Completed in 149ms
171 timing reify:rollback:retireShallow Completed in 0ms
172 timing command:install Completed in 10922ms
173 verbose stack Error: command failed
173 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
173 verbose stack     at ChildProcess.emit (node:events:520:28)
173 verbose stack     at maybeClose (node:internal/child_process:1090:16)
173 verbose stack     at Socket.<anonymous> (node:internal/child_process:449:11)
173 verbose stack     at Socket.emit (node:events:520:28)
173 verbose stack     at Pipe.<anonymous> (node:net:687:12)
174 verbose pkgid @serialport/bindings-cpp@10.7.0
175 verbose cwd /mnt/dietpi_userdata/node-red
176 verbose Linux 5.10.103-v8+
177 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--no-audit" "--no-update-notifier" "--no-fund" "--save" "--save-prefix=~" "--production" "--engine-strict" "node-red-node-serialport@1.0.1"
178 verbose node v17.4.0
179 verbose npm  v8.5.5
180 error code 126
181 error path /mnt/dietpi_userdata/node-red/node_modules/@serialport/bindings-cpp
182 error command failed
183 error command sh -c node-gyp-build
184 error sh: 1: node-gyp-build: Permission denied
185 verbose exit 126
186 timing npm Completed in 11615ms
187 verbose unfinished npm timer reify 1648561620214
188 verbose unfinished npm timer reify:build 1648561630909
189 verbose unfinished npm timer build 1648561630912
190 verbose unfinished npm timer build:deps 1648561630912
191 verbose unfinished npm timer build:run:install 1648561630926
192 verbose unfinished npm timer build:run:install:node_modules/@serialport/bindings-cpp 1648561630927
193 verbose code 126
194 error A complete log of this run can be found in:
194 error     /mnt/dietpi_userdata/node-red/.npm/_logs/2022-03-29T13_46_59_529Z-debug-0.log

I have no knowledge about node-red, but when I look into the log I see this
184 error sh: 1: node-gyp-build: Permission denied
so it’s a permission issue.

I found some kind related thread on stackoverflow:

And there is another error at line 173, but IDK nothing about this.
Maybe it’s also worth looking into the log mentioned at the last line.

In the meantime I figured out, that the problem obviously started with the last update to Version > 8.1.2.
Until 8.1.2 I am able to install serialport without any issues.

I think I will take the time to find out, if it has something to do with the update itself, or if there is any other changes, that I made the same time…

There was no change related to Node-Red on the last update
Usually we don’t do any update on already installed software. Maybe there was an update of the node package themself?

Anyway. Have a look to /mnt/dietpi_userdata/node-red/node_modules/@serialport/. It should belong to nodered user to allow r/w operation