Installing Windows Build Tools

In the instructions for installing on Windows, under " Installing Node.js Windows Build Tools" it gives two options. It says to use the second one "If you wish to have the built-in Python v2.7 install exposed for use". If the second one is not used, can that give to the problem seen in Facing problem in installing -node-arduino - #9 by binyameenaslam342 where the serialport install fails because it cannot find Python?

I don't use Windows, I am asking in order to help with that thread and this problem has appeared multiple times in the forum with different nodes pulling in the serialport.

1 Like

That actually needs updating now because newer versions of Node.js for windows have the build tools included, the old npm package is now deprecated. All you need to do now is simply install node.js from the official executable on the website.

One of the reasons I don't like Python is because of the myriad different versions available on different platforms. It is confusing, there should be a single official source. This is especially true on Windows.

Is that the one linked to from the node red Installing on Windows page? https://nodejs.org/en/
If so, then do you know what may cause the missing python seen the linked thread?

I have taken delivery of a brand new Windows 11 desktop yesterday :slight_smile:
(Last one was 10 years old!)

I've not installed NR on it even yet.

Got plenty of Arduinos :slight_smile:

If you want to use me as a testbed - give me a shout and I'll follow your instructions (without deviation or alteration) :slight_smile:

JFI It doesn't come with any version of python installed - if I type python in a cmd terminal - it jumps straight to offering Python 3.9 from the Windows app store

That would be great. I was just thinking of asking if anyone has a virgin windows VM they could try it on. I have extra RAM and larger SSD on my Xmas list which will give me enough to run VMs (under Ubuntu) but I can't at the moment.

I think the best thing to do would be to install as in the Running in Windows docs, Quick Start section. So not installing the build tools. Then see if node-red-node-arduino will install. @TotallyInformation thinks the build tools should be installed along with nodejs. If it fails with the missing python error (as in the thread I linked) then try to see if python is installed, and it is just that it is not in the path, or if it is not installed at all.

The instructions say download node 14 but I am being offered node 16 as LTS version - shall I use node 16?

1 Like

Maybe best to follow the docs for the moment, assuming 14 is there.

OK - installing last 14. version 14.8.2

I assume click to install tools (python etc?)
image

Yes, that needs to be added to the docs.

And todays award for most gobblygook log message goes to...

2 Likes

Its suggested rebooting after that so I have

Ran the version check in a cmd window

image

did the
npm install -g --unsafe-perm node-red

got

C:\Users\siwal>npm install -g --unsafe-perm node-red
C:\Users\siwal\AppData\Roaming\npm\node-red-pi -> C:\Users\siwal\AppData\Roaming\npm\node_modules\node-red\bin\node-red-pi
C:\Users\siwal\AppData\Roaming\npm\node-red -> C:\Users\siwal\AppData\Roaming\npm\node_modules\node-red\red.js

> bcrypt@5.0.1 install C:\Users\siwal\AppData\Roaming\npm\node_modules\node-red\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

[bcrypt] Success: "C:\Users\siwal\AppData\Roaming\npm\node_modules\node-red\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" is installed via remote
+ node-red@2.1.4
added 295 packages from 374 contributors in 39.448s

then

C:\Users\siwal>node-red
2 Dec 17:49:52 - [info]

Welcome to Node-RED
===================

2 Dec 17:49:52 - [info] Node-RED version: v2.1.4
2 Dec 17:49:52 - [info] Node.js  version: v14.18.2
2 Dec 17:49:52 - [info] Windows_NT 10.0.22000 x64 LE
2 Dec 17:49:52 - [info] Loading palette nodes
2 Dec 17:49:53 - [info] Settings file  : C:\Users\siwal\.node-red\settings.js
2 Dec 17:49:53 - [info] Context store  : 'default' [module=memory]
2 Dec 17:49:53 - [info] User directory : C:\Users\siwal\.node-red
2 Dec 17:49:53 - [warn] Projects disabled : editorTheme.projects.enabled=false
2 Dec 17:49:53 - [info] Flows file     : C:\Users\siwal\.node-red\flows.json
2 Dec 17:49:53 - [info] Creating new flow file
2 Dec 17: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.
---------------------------------------------------------------------

2 Dec 17:49:53 - [info] Server now running at http://127.0.0.1:1880/
2 Dec 17:49:53 - [info] Starting flows
2 Dec 17:49:53 - [info] Started flows

node-red-node-arduino install log

2021-12-02T17:53:32.813Z Install : node-red-node-arduino 0.3.1

2021-12-02T17:53:32.818Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-arduino@0.3.1
2021-12-02T17:53:46.363Z [out] 
2021-12-02T17:53:46.363Z [out] > @serialport/bindings@8.0.8 install C:\Users\siwal\.node-red\node_modules\@serialport\bindings
2021-12-02T17:53:46.363Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-12-02T17:53:46.363Z [out] 
2021-12-02T17:53:46.862Z [err] prebuild-install WARN
2021-12-02T17:53:46.863Z [err]  install No prebuilt binaries found (target=14.18.2 runtime=node arch=x64 libc= platform=win32)
2021-12-02T17:53:46.871Z [out] 

2021-12-02T17:53:46.871Z [out] C:\Users\siwal\.node-red\node_modules\@serialport\bindings>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 

2021-12-02T17:53:56.174Z [out] Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.

2021-12-02T17:53:57.248Z [out]   serialport.cpp

2021-12-02T17:53:57.248Z [out]   serialport_win.cpp

2021-12-02T17:53:57.248Z [out]   win_delay_load_hook.cc

2021-12-02T17:53:58.738Z [out]      Creating library C:\Users\siwal\.node-red\node_modules\@serialport\bindings\build\Release\bindings.lib and object C:\Users\siwal\.node-red\node_modules\@serialport\bindings\build\Release\bindings.exp

2021-12-02T17:53:59.134Z [out]   bindings.vcxproj -> C:\Users\siwal\.node-red\node_modules\@serialport\bindings\build\Release\\bindings.node

2021-12-02T17:53:59.195Z [out] 
2021-12-02T17:53:59.195Z [out] > serialport@8.0.8 postinstall C:\Users\siwal\.node-red\node_modules\serialport
2021-12-02T17:53:59.195Z [out] > node thank-you.js
2021-12-02T17:53:59.195Z [out] 
2021-12-02T17:53:59.243Z [out] e[96me[1mThank you for using serialport!e[96me[1m
2021-12-02T17:53:59.243Z [out] e[0me[96mIf you rely on this package, please consider supporting our open collective:e[22me[39m
2021-12-02T17:53:59.243Z [out] > e[94mhttps://opencollective.com/serialport/donatee[0m
2021-12-02T17:53:59.243Z [out] 
2021-12-02T17:53:59.243Z [out] 
2021-12-02T17:53:59.302Z [err] npm notice created a lockfile as package-lock.json. You should commit this file.
2021-12-02T17:53:59.303Z [out] + node-red-node-arduino@0.3.1
2021-12-02T17:53:59.303Z [out] added 78 packages from 48 contributors in 25.661s
2021-12-02T17:53:59.320Z rc=02021-12-02T17:53:32.813Z Install : node-red-node-arduino 0.3.1

2021-12-02T17:53:32.818Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-arduino@0.3.1
2021-12-02T17:53:46.363Z [out] 
2021-12-02T17:53:46.363Z [out] > @serialport/bindings@8.0.8 install C:\Users\siwal\.node-red\node_modules\@serialport\bindings
2021-12-02T17:53:46.363Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2021-12-02T17:53:46.363Z [out] 
2021-12-02T17:53:46.862Z [err] prebuild-install WARN
2021-12-02T17:53:46.863Z [err]  install No prebuilt binaries found (target=14.18.2 runtime=node arch=x64 libc= platform=win32)
2021-12-02T17:53:46.871Z [out] 

2021-12-02T17:53:46.871Z [out] C:\Users\siwal\.node-red\node_modules\@serialport\bindings>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 

2021-12-02T17:53:56.174Z [out] Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.

2021-12-02T17:53:57.248Z [out]   serialport.cpp

2021-12-02T17:53:57.248Z [out]   serialport_win.cpp

2021-12-02T17:53:57.248Z [out]   win_delay_load_hook.cc

2021-12-02T17:53:58.738Z [out]      Creating library C:\Users\siwal\.node-red\node_modules\@serialport\bindings\build\Release\bindings.lib and object C:\Users\siwal\.node-red\node_modules\@serialport\bindings\build\Release\bindings.exp

2021-12-02T17:53:59.134Z [out]   bindings.vcxproj -> C:\Users\siwal\.node-red\node_modules\@serialport\bindings\build\Release\\bindings.node

2021-12-02T17:53:59.195Z [out] 
2021-12-02T17:53:59.195Z [out] > serialport@8.0.8 postinstall C:\Users\siwal\.node-red\node_modules\serialport
2021-12-02T17:53:59.195Z [out] > node thank-you.js
2021-12-02T17:53:59.195Z [out] 
2021-12-02T17:53:59.243Z [out] e[96me[1mThank you for using serialport!e[96me[1m
2021-12-02T17:53:59.243Z [out] e[0me[96mIf you rely on this package, please consider supporting our open collective:e[22me[39m
2021-12-02T17:53:59.243Z [out] > e[94mhttps://opencollective.com/serialport/donatee[0m
2021-12-02T17:53:59.243Z [out] 
2021-12-02T17:53:59.243Z [out] 
2021-12-02T17:53:59.302Z [err] npm notice created a lockfile as package-lock.json. You should commit this file.
2021-12-02T17:53:59.303Z [out] + node-red-node-arduino@0.3.1
2021-12-02T17:53:59.303Z [out] added 78 packages from 48 contributors in 25.661s
2021-12-02T17:53:59.320Z rc=0

I'll have to dig out an arduino and install firmata but I think that everything has gone well AFAICT

2 Likes

Excellent. So the conclusion seems to be that we should tell users to select that box to install the tools, and remove the section in the docs about installing the build tools manually. Does that make sense?

1 Like

Yes - and to follow advice to reboot after node.js is installed.

So summarising the docs changes required on Running on Windows : Node-RED

  1. In Quick Start > Install Node.js: Add note to say click the checkbox to install the build tools. Also to reboot after install of nodejs.

  2. Remove the section 'Installing Node.js Windows Build Tools'. The package suggested in that section is no longer maintained as it has been superseded by the version that comes with nodejs.

  3. Move the Notes section currently at the end of Installing Node.js Windows Build Tools up to the end of Quick Start. At least I think that is where it should go.

Unfortunately my primary broadband is down due to a falling tree taking out the fibre in a storm last weekend so I only have access via the phone at the moment. It could be another week before it is up again. Then I am away for two weeks so I probably won't be able to fork the docs and create a PR for several weeks. If someone would like to volunteer to do it before then that would be great. Otherwise I will do it when I can.

I have also just noticed that on the Supported Node Versions page, under Installing Node.js the 'Node provides guides' link does not lead anywhere helpful for Windows. The sentence 'If you are running on a ...' should be extended to include a link to the Windows guide for Windows users. In fact it should also say to use the Pi guide for Ubuntu and other Debian OSs.

It would be nice to know what to tell anyone who installs without ticking the tools checkbox how to later install the tools. Could you try re-running the nodejs install (without uninstalling it, initially) and see if it gives you the tools option again?

Hello @Colin .. i can confirm that re-running the windows nodejs v14.18.2 installer, you will be presented with 3 options .. to Change, Repair or Remove nodejs. If you click Change and click Next you can then choose to install the build tools.

1 Like

It is also possible to install the libraries and Python manually of course. The libraries and C/C++ compiler are part of visual studio which has a component installer that is freely installable.

Much easier to do it via the node.js install of course.

image

I clicked on change and then 2 screens further on it gave me the option as before

image

edit just saw that @UnborN had already answered :slight_smile:

I tick mark this too when I reinstalled nodejs but it did not work either. One single error because of any reason and you have to reinstall it again or do yourself a favour, move to Linux.