Installation of node-red-mcu-plugin keeps failing

Hi folks,

Some time ago I installed the node-red-mcu-plugin directly from @ralphwetzel his Github account. Meanwhile he has published his package on npm, so I wanted to install that. Unfortunately it keeps failing:

pi@raspberrypi:~/.node-red $ npm install @ralphwetzel/node-red-mcu-plugin
npm ERR! Cannot set properties of null (setting 'peer')
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2023-01-30T22_17_13_696Z-debug-0.log

Doesn't work, whatever I tried. Cannot install it from npm, but now I can't even install his new library anymore from his Github repository.

Does anybody has some tips?

I am using NodeJs v16.17.0 and Npm v8.16.0 on a Raspberry Pi (64 bit).

This is the detailed log:

pi@raspberrypi:~/.node-red $ cat /home/pi/.npm/_logs/2023-01-31T20_54_05_711Z-debug-0.log
0 verbose cli /usr/bin/node /usr/bin/npm
1 info using npm@8.19.3
2 info using node@v16.17.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 6ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 5ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/home/pi/.node-red/.npmrc Completed in 0ms
10 timing config:load:project Completed in 36ms
11 timing config:load:file:/home/pi/.npmrc Completed in 2ms
12 timing config:load:user Completed in 3ms
13 timing config:load:file:/usr/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 2ms
17 timing config:load:setEnvs Completed in 3ms
18 timing config:load Completed in 65ms
19 timing npm:load:configload Completed in 65ms
20 timing npm:load:mkdirpcache Completed in 2ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm install ralphwetzel/node-red-mcu-plugin
23 verbose argv "install" "ralphwetzel/node-red-mcu-plugin"
24 timing npm:load:setTitle Completed in 3ms
25 timing config:load:flatten Completed in 9ms
26 timing npm:load:display Completed in 15ms
27 verbose logfile logs-max:10 dir:/home/pi/.npm/_logs
28 verbose logfile /home/pi/.npm/_logs/2023-01-31T20_54_05_711Z-debug-0.log
29 timing npm:load:logFile Completed in 15ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 107ms
33 timing arborist:ctor Completed in 2ms
34 silly logfile start cleaning logs, removing 2 files
35 silly logfile done cleaning log files
36 timing idealTree:init Completed in 2449ms
37 timing arborist:ctor Completed in 0ms
38 timing idealTree:userRequests Completed in 3036ms
39 silly idealTree buildDeps
40 silly fetch manifest @ralphwetzel/node-red-mcu-plugin@ralphwetzel/node-red-mcu-plugin
41 silly placeDep ROOT @ralphwetzel/node-red-mcu-plugin@1.1.2-post REPLACE for: node-red-project@0.0.1 want: ralphwetzel/node-red-mcu-plugin
42 silly fetch manifest eta@^2.0.0
43 silly fetch manifest fast-xml-parser@^4.0.12
44 http fetch GET 200 285ms (cache revalidated)
45 http fetch GET 200 966ms (cache revalidated)
46 timing idealTree:#root Completed in 2089ms
47 silly placeDep ROOT eta@2.0.0 OK for: @ralphwetzel/node-red-mcu-plugin@1.1.2-post want: ^2.0.0
48 silly placeDep node_modules/@ralphwetzel/node-red-mcu-plugin fast-xml-parser@4.0.15 OK for: @ralphwetzel/node-red-mcu-plugin@1.1.2-post want: ^4.0.12
49 timing idealTree:node_modules/@ralphwetzel/node-red-mcu-plugin Completed in 20ms
50 timing idealTree:node_modules/eta Completed in 0ms
51 timing idealTree:node_modules/@ralphwetzel/node-red-mcu-plugin/node_modules/fast-xml-parser Completed in 0ms
52 timing idealTree:buildDeps Completed in 2115ms
53 timing idealTree Completed in 7605ms
54 timing command:install Completed in 7646ms
55 verbose stack TypeError: Cannot set properties of null (setting 'peer')
55 verbose stack     at visit (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:104:54)
55 verbose stack     at visitNode (/usr/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:58:25)
55 verbose stack     at next (/usr/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:44:19)
55 verbose stack     at depth (/usr/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:83:10)
55 verbose stack     at depth (/usr/lib/node_modules/npm/node_modules/treeverse/lib/depth.js:27:12)
55 verbose stack     at unsetFlag (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:99:5)
55 verbose stack     at /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:65:7
55 verbose stack     at Map.forEach (<anonymous>)
55 verbose stack     at calcDepFlagsStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:41:17)
55 verbose stack     at visit (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:12:20)
56 verbose cwd /home/pi/.node-red
57 verbose Linux 5.15.32-v8+
58 verbose node v16.17.0
59 verbose npm  v8.19.3
60 error Cannot set properties of null (setting 'peer')
61 verbose exit 1
62 timing npm Completed in 8001ms
63 verbose unfinished npm timer reify 1675198446060
64 verbose unfinished npm timer reify:loadTrees 1675198446090
65 verbose unfinished npm timer idealTree:fixDepFlags 1675198453695
66 verbose code 1
67 error A complete log of this run can be found in:


Could you try deleting (or renaming) package-lock.json then retry install?

Hey Steve,
thanks for the assistance!

But renaming that file does not solve the issue unfortunately:

Test 2...

  1. delete package lock once more
  2. delete npm cache ( Cache files are stored in ~/.npm on Posix, or %AppData%/npm-cache on Windows.)
  3. try NPM install again

Test 3 (more extreme)...

  1. delete package lock once more
  2. delete npm-cache ( Cache files are stored in ~/.npm on Posix, or %AppData%/npm-cache on Windows.)
  3. modify npm/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js ...
@@ -30,7 +30,7 @@ const calcDepFlagsStep = (node) => {
   resetParents(node, 'optional')

   // for links, map their hierarchy appropriately
-  if (node.isLink) {
+  if (node.isLink && { = = node.optional = node.devOptional
@@ -100,11 +100,11 @@ const unsetFlag = (node, flag) => {
       tree: node,
       visit: node => {
         node.extraneous = node[flag] = false
-        if (node.isLink) {
+        if (node.isLink && {
  =[flag] = false
-      getChildren: node => []
+      getChildren: node => [...( ?? [])]
         .filter(edge => &&[flag] &&
           (flag !== 'peer' && edge.type === 'peer' || edge.type === 'prod'))
         .map(edge =>,
  1. try NPM install again
  • Removing the cache did not help, neither via npm cache clean --force nor by cleaning the content of that ~/.npm folder.
  • After changing the calc-dep-flags.js file, I get another error:

Seems to be a stubborn issue...

This appears to be a common and recurring issue with npm:

[BUG] Cannot set property 'peer' of null · Issue #3711 · npm/cli (

[BUG] Cannot set property 'peer' of null · Issue #5007 · npm/cli (

Suggestion seems to be that it is a problem with a package that contains a link.

Clearly there are multiple bugs in npm (no surprises there). No definitive fix right now. but some people have had at least temporary success with some workarounds.

Hmm yes, but I am afraid that some of these workaround seem to me that lots of other things can go wrong again...

1 Like

Yes, deleting and reinstalling Node.js seemed to be the safest of them :slight_smile:

have you tried blowing away node_modules and then npm i?

Hmm no. Because not sure if that could result in my system being messed up, and me troubleshooting for the next week all my free time without writing a single line of code for my nodes :wink:

But perhaps it is common practice. Don't know...

Its pretty safe actually. I've done it many times without issue. If in doubt, simply create a clone backup of your node-red userDir folder. Then you know you can recover simply by renaming folders.

1 Like

Here is the sidebar from @ralphwetzel finally:


I have executed the following steps, in case anbody else (like e.g. myself...) runs into the same problem in the future:

  1. Created a backup copy of my .node-red folder
  2. Removed my .node-red/node_modules folder
  3. Cleared my npm cache via npm cache clean --force
  4. Removed my package-lock.json file
  5. Did an npm install but that failed all the time with error "Error: The git reference could not be found".
  6. I removed manually all lines from my package.json file (in my .node-red folder) that:
    • Referred to github repo's that are not valid anymore: for some github repos the file pointed to a git branch of that repo that didn't exist anymore.
    • Removed all the repo's from Kevin Godell's nodes, because he has published them recently on npm. And he has used now an "@kevingodell" prefix, which resulted in errors.
    • Removed the old mcu plugin link to Ralph's mcu plugin node.
  7. I manually did an npm install again for all the node's from Kevin and Ralph that meanwhile had become available on npm.

And then it seems to work...

Thanks guys for all the assitance!!!!!!!!!!!!!!!!!!!!!


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