noble-uwp
noble-uwp copied to clipboard
Building from source on Node 11 fails
Version 11 helpfully installs Windows build tools making the whole process a bit less painful. Unfortunately, it seems to try to run two copies of node-pre-gyp at the same time:
Installing NodeRT UWP adapter for Windows.Storage.Streams node-pre-gyp ERR! Tried to download(404): https://github.com/jasongin/noble-uwp/releases/download/windows_storage_streams_0.15063.1/binding-v0.15063.1-node-v67-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI) (falling back to source compile with node-gyp) node-pre-gyp ERR! Tried to download(undefined): https://github.com/jasongin/noble-uwp/releases/download/windows_storage_streams_0.15063.1/binding-v0.15063.1-node-v67-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI) (falling back to source compile with node-gyp)
Which leads to an error like:
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 393, in close os.rename(self.tmp_path, filename) WindowsError: [Error 183] Cannot create a file when that file already exists
Using the script below, I could manually build the modules, then run npm rebuild noble-uwp
to finish off. Hopefully, this may help someone else.
set node="C:\Program Files\nodejs\node.exe" set node_gyp="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" set proj_dir= set uwp_dir=%proj_dir%\node_modules\noble-uwp\uwp
set module_dir=%uwp_dir%\windows.foundation cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"
set module_dir=%uwp_dir%\windows.storage.streams cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"
set module_dir=%uwp_dir%\windows.devices.bluetooth cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"
set module_dir=%uwp_dir%\windows.devices.bluetooth.advertisement cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"
set module_dir=%uwp_dir%\windows.devices.bluetooth.genericattributeprofile cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"
set module_dir=%uwp_dir%\windows.devices.enumeration cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"
set module_dir=%uwp_dir%\windows.devices.radios cd %module_dir% set module=%module_dir%\binding\node-v67-win32-x64\binding.node set module_path=%module_dir%\binding\node-v67-win32-x64 %node% %node_gyp% "configure" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%" %node% %node_gyp% "build" "--fallback-to-build" "--msvs_version=2015" "--module=%module%" "--module_name=binding" "--module_path=%module_path%"