Running node-serialport in nw.js - node.js

I am trying to run node-serialport in nw.js. After following the nw.js documentation concerning native modules, node-serialport seems to build just fine, and runs perfectly in a regular node process.
Unfortunately, I get the following error in the nw.js console window:
{project_dir}\node_modules\serialport\node_modules\bindings\bindings.js:83 Uncaught Error: Module version mismatch. Expected 48, got 46.
How can I run these together? Am I missing something obvious?
Note that I'm currently running:
Windows 7 x64
Node v4.4.4
npm v2.4.1
nw.js v0.15.0
node-gyp v3.3.1
serialport v3.1.2

Apparently I needed to update to the Current version of Node (v6.2.0) instead of the LTS version (v4.4.4). After updating and rebuilding serialport, everything works perfectly!

Related

When you start Electron, you get an error that the version of Node.js is not supported

When you start Electron, you get an error that the version of Node.js is not supported.
The operating system is Windows.
When I update Node.js and do node -v, it shows v16.17.1.
When I start it with npm run electron:serve, the following error appears again.
What could be the cause?
The following modules are used to start Electron.
"vue-cli-plugin-electron-builder".
You are running Node.js 12.14.1.
Playwright requires Node.js 14 or higher.
Please update your version of Node.js.

Firestore snapshot fails in Raspbian OS

My code runs MacOS, Windows 10 and Ubuntu. However when I run it on Raspbian, I get the error
Encountered error: Error: #grpc/grpc-js only works on Node ^8.13.0 || >=10.10.0
(node:18099) ExperimentalWarning: The http2 module is an experimental API.
my versions are:
pi#raspberrypi:~ $ node -v
v13.1.0
pi#raspberrypi:~ $ npm -v
6.12.1
The problem occurs when I set the snapshot for a firebase focument. Thank you guys in advance...
If you trying to run an electron js based app on device which has cpu with arm architecture you have to use either electron#3.0.13 or electron#5.0.0 . In addition, if are you going to use another library which uses grpc , use electron#5.0.0 . Otherwise you will drown in errors. Just delete the version of electron in packege.json file. Make that line as electron: "5.0.0" and delete node_modules with package-lock.json file. After npm install you are good to go.

I got the following error in node version 8+

Previous node version is 7.9.0. The project was running well.
When I upgraded it to 8.9.4, I got the following errors.
ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/sass/styles.scss
Module build failed: Error: Missing binding F:\LogicSoft-SRL\angular-frontdesk\node_modules\node-sass\vendor\win32-x64-57\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 7.x
How can I fix this error in the current version(8.9.4)?
From the error message, it looks like you have to rebuild node-sass for your node version. You can do this by running the command from this answer.
npm rebuild node-sass
You can find more info on the rebuild command here.

electron build error when using robot-js on windows

I am trying to use robot-js with Electron, but when I try to start my app I get the following error:
http://imgur.com/a/w1eis
Cannot find module "./win32-x64-54"
Without robot-js my app runs fine. I am using robot-js version 1.0.2 and have the windows-build-tools installed.
EDIT: This problem only occurs with Electron, in a standard Node-Project the robot-js runs fine.
Adding a .npmrc file and npm rebuild solved my issue, see here: https://github.com/nodegit/nodegit/issues/1259#issuecomment-289600717

Using phantom on Node webkit

I am trying to scrape dynamic content in Node webkit by using Phantom .
I have added phantomjs to env variable also.
When i run the application i get a version mismatch error:
"Uncaught Error: Module version mismatch. Expected 43, got 46."
By running nw:version i get the following versions:
nw.js v0.12.3
io.js v1.2.0
Chromium 41.0.2272.76
How should i get around this error?
If you were able to implement similar functionality using some other package, let me know.
Native modules (phantom is one of them, my experience was with lwip) must be rebuilt to work inside nw.js; the ones you install with npm are not compatible. It is also recommended to install node.js version matching that which is used by nw.js (i.e. io.js 1.2.0).
The instruction on how to rebuild: https://github.com/nwjs/nw.js/wiki/build-native-modules-with-nw-gyp
Basically, you would
$ npm install -g nw-gyp
$ cd node_modules/phantom
$ nw-gyp configure --target=0.12.3
$ nw-gyp build
Note "0.12.3" version in configure because that's what your nw:version shows.
Also, note different pre-requisites depending on which OS you use: https://github.com/nwjs/nw-gyp
To do web-scraping in nw.js I successfully use the following stack (on Windows 7):
nw.js 0.12.3
phantomjs module with phantomjs 1.9.8 or 2.0.1b
node-phantom-simple module

Resources