JavaScript SDK on Windows 10 machine

Hello,

I purchased a few sensors from you and would like to use the JavaScript API on a Windows 10 machine. Unfortunately there are a few problems that I encountered so far and would need your assistance if possible.
I understood that Linux works ‘out of the box’ and that I need to setup some things independently if I want to use a Windows machine. This being said, I setup Noble (https://github.com/abandonware/noble) along with windows-build-tools (visual studio 2017), node-gyp and bluetooth-hci-socket. Installed node ( v. 8.15.0 ) and python 2.7 as well. Noble was tested separately and works fine.
The main problem that I encounter is regarding the metawear install script from the package.json while running npm install, like so:

metawear@0.3.0 install pathmetawear
make OPT_FLAGS=-Wno-strict-aliasing -C MetaWear-SDK-Cpp/ -j

make: Entering directory ‘path/metawear/MetaWear-SDK-Cpp’
File not found – *.cpp
File not found – *.cpp
File not found – *.cpp
File not found – *.cpp
File not found – *.cpp
File not found – *.cpp
File not found – *.cpp
File not found – *.h
File not found – *.h
File not found – *.h
File not found – *.h
File not found – *.h
File not found – *.h
File not found – *.h
g++ -o dist/release/lib/x64/libmetawear.so.0.17.0 -s -shared -Wl,–soname,libmetawear.so.0 -m64
process_begin: CreateProcess(NULL, g++ -o dist/release/lib/x64/libmetawear.so.0.17.0 -s -shared -Wl,–soname,libmetawear.so.0 -m64, …) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:77: dist/release/lib/x64/libmetawear.so.0.17.0] Error 2
make: Leaving directory ‘path/metawear/MetaWear-SDK-Cpp’
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! metawear@0.3.0 install: make OPT_FLAGS=-Wno-strict-aliasing -C MetaWear-SDK-Cpp/ -j
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the metawear@0.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Considering that this might be related to the fact that the code is destined to linux compilling, I manually installed the Visual Studio 2017 packages that you mentioned on the Python tutorial and ran

release build for Win32 applications targeting the x64 architecture

msbuild MetaWear.Win32.vcxproj /p:Configuration=Release;Platform=x64
which succesfully generated the win32 files in the dist folder, but this did not solve the problem since the install script looks for the libmetawear.
At this point I am stuck and would like to know if there is something else I can do/replace in order to successfully install the node_modules. Maybe the order in which I am doing the setup is not correct.
Also, on the github issues it is mentioned that it should be used the latest version of ffi instead of the one currently on the package.json. Don’t know if this affects considerably the installation.

Thank you for your time.

Comments

  • edited May 27

    You missed the submodules when you cloned the repository, please run:

    git clone --recurse-submodules https://github.com/mbientlab/MetaWear-SDK-JavaScript.git
    

    and don't forget to update!

  • Hi Laura, thanks for the quick response. I already used the git clone command and I have the same error. Do I need to redirect everything to the win32.lib since I am using Windows? Because I am seeing that the installation expects
    the libmetawear.so.0.17.0 which is not generated in this case.

  • is any libmetawear.so created at all?

  • Can you show me whats going on in more details including screenshots. Where are you in the install process?

  • Sure. I think that I am not following the correct order of the process. I installed noble (along with hci, node-gyp and windows-build-tools), tested it and worked. After this, I cloned the metawear repo (made sure the folder metawear sdk cpp is properly transferred) and tried to run npm install, but had the error "'make' is not recognized as an internal or external command,operable program or batch file" (see screenshot 1), and further installed the 'make' package through choco. When I ran npm install again, I did not had the previous error, but in exchange a new error appeared (see screenshot 2 + log attached). From this point, no matter what I did, I only had this error. Later I followed the Python for Windows tutorial and manually installed the VS 2017 packages, and then ran the ms build command to build the win32 files. I successfully generated the files in the dist folder, but this did not solve anything. Also no libmetawear.so files were created.

    Thank you for your help and time!

  • edited May 28

    what does your folder look like? Do you have all the submodules installed? Show me the entire contents of your MeaWear-SDK-Javascript folder and the MetaWear-SDK-Cpp folder.
    What node and npm version?
    Can you follow each step in the install process from our tutorials and show me the output each time.
    It looks like you missed a step somewhere in the install process.

  • I should let you know we don't support Node.JS + Windows so I may not be able to help you further (it is possible to get it to work but we don't support it in our tutorials right now).

  • Hi Laura. I indeed wanted to use Node.js with Windows, but since you don't offer support on it, I tried to use a VM with Ubuntu, like in your tutorial. I followed all the steps but as far as I saw in already posted issues, it is recommended to use Nodejs 8.15.0, which I used by NVM. The installation goes well, but when I try to run a file from the example folder (like led.js) I get the following error:
    internal/modules/cjs/loader.js:807
    return process.dlopen(module, path.toNamespacedPath(filename));
    ^
    Error: The module '/home/user/MetaWear-SDK-JavaScript/node_modules/bluetooth-hci-socket/build/Release/binding.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 57. This version of Node.js requireshttps://github.com/mbientlab/MetaWear-SDK-JavaScript/issues/11
    NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
    the module (for instance, using npm rebuild or npm install).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object. (/home/user/MetaWear-SDK-JavaScript/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

    Did you ever encounter this error? Should I try to use nodejs 8.15.0 further or should I insist with 10.19? I tried to use nodejs 10.19 and after I cloned the repo, I changed the package.json file according to this issue (https://github.com/mbientlab/MetaWear-SDK-JavaScript/issues/11). The installation worked, but when I tried to run node led.js, nothing happened (i updated the mac address to my sensor).

    Thank you for your time!

  • Just npm install

  • @Kina , I had the same issue as you did when trying to get the MetaWear Javascript SDK to work on Windows 10. Like you, I first had the "'make' is not recognized" error, but was able to fix it by installing make for Windows from GnuWin32. But then, like you, I got stuck with the second set of errors, the one where I get 14 "File not found" errors for *.cpp and *.h. I eventually gave up and ended up getting the MetaWear Javascript SDK to work on my Mac using some changes I had to make to noble.

  • Again we don't fully support the Node.JS on Windows so it would take some work to get it to function.

Sign In or Register to comment.