Google-cloud + Node, grpc error - node.js

I am creating a sample desktop application using electron framework. When i include google-cloud node library in application i got this error.
Uncaught Error:
/home/user/Desktop/projects/sample_desktop_app/node_modules/grpc/src/node/extension_binary/grpc_node.node:
undefined symbol: GENERAL_NAME_free
OS: Ubuntu
Node Version: v7.10.0
Your help would be appreciated

Grpc id a native module that also is not officially supported for electron. This is because native modules are generally hard with electron as they need special treatment or recompilation for the respective platform.
Best way is to follow this thread https://github.com/grpc/grpc/issues/6138 but you are more or less on your own with it. I would try to have your own backend and proxy grpc calls.

Related

Deploying Node.js app with gdal | AWS Elastic Beanstalk

I'm trying to deploy a node.js app but get stuck with an error about missing dependencies for gdal.
Error: /lib64/libm.so.6: version 'GLIBC_2.27' not found (required by /var/app/current/node_modules/gdal/lib/binding/gdal.node)
How would I go about installing this required dependency?
gdal-async on npm explicitly supports AWS.
As its author, I will be happy to help you if it doesn't work - you can create an issue on github.
I don't know what you call gdal.js.
There is the original gdal by Mapbox and Natural Atlas that is not actively developed anymore.
There is gdal-next on which I used to work a little bit which has a current version of GDAL but it is not very active either.
There is my gdal-async which is the only one that is currently active.
And there is an Emscripten port that is pure JS and runs in the browser, but it is stalled at GDAL 2.
Supporting AWS is simply a matter of compiling with the right libraries.

Why is there a mismatch of module versions between Electron and Node.JS?

I have a node project in which I use NodeJS 14.15.0 and the latest build of Electron 12.0.0.
NodeJS version 14.15.0 has a NODE_MODULE_VERSION 83 according to their webpage.
Electron version v12.0.0 uses this node version of 14.15.0. but on their webpage it says the module NODE_MODULE_VERSION is 87
Therefore I have a mismatch between these two versions. I need a match so I can load the same binary intro an Electron app + execute by a node.js instance.
Electron maintains and compiles their own fork of Node, in a way that may not be compatible with normal Node. Electron intentionally uses unique NODE_MODULE_VERSION to signal this fact to software.
You'll need to recompile native modules using electron-rebuild.
Native Node modules are supported by Electron, but since Electron is very likely to use a different V8 version from the Node binary installed on your system, the modules you use will need to be recompiled for Electron.
(electron docs)
The maintainers of Node and Electron discussed possible options, and decided to use offset versioning in this issue:
https://github.com/nodejs/TSC/issues/651

upgrading node for electron

I am creating an app using electron framework but when I'm trying to use async functions it gives me an error.
Because my electron uses node version 6.5.0 but node in this version doesn't support async functions.
So I am trying to upgrade my electron's node but I don't know how to create a branch or stuff like that since https://electronjs.org/docs/development/upgrading-node is the only link I found to explain this matter but I can't understand it. Can I upgrade node in my electron framework in another way?
Can I upgrade node in my electron framework in another way
No, you cannot. Electron links a specific version of node with chromium in its build time, so each version of electron have a fixed version of node.js and cannot be replaced dynamically.
Either use a higher version of the electron have higher node.js version, try to manually build electron yourself is the only way to go.

Node.js version and Google Cloud functions

I get this message when I start a local Firebase server with firebase serve:
Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports v6.11.5.
But there is no info about what to do. What do I need to do to downgrade Node.js to v6.11.5? Should I use that version just for Firebase projects and the latest released version of Node.js for other projects? In that case how to I do that?
EDIT: The warning now looks like this and I am unable to run a new nearly empty project:
Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports v6.11.5.
! functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
! functions: Error from emulator. mod.hasOwnProperty is not a function
So I really think I have to downgrande Node.js. But I do not know how to safely do that. Hm, looking at http://nodejs.org/ I can't even find version v6.11.5?
EDIT 2: Just checked in the new project if npm update --dev fixed the problem. It did not. (Actually no packages where updated.)
That's just a warning. You can ignore it if you know what you're doing. It's telling you that your local emulation of a function (running on node 8.9.4) may not perfectly match what the function will do when it's deployed to Cloud Functions (running 6.11.5). But as long as you're not using any features of node that are not available on node 6.11.5, you won't have a problem. I use newer versions of node to test locally all the time without problems.
You can uninstall and reinstall Cloud Functions emulator and Firebase Tools using the commands provided in the GitHub Troubleshooting guide. Since you are using Firebase, follow the instruction for the ‘Firebase Tools’.
Node v8 is now available for cloud functions:
https://firebase.googleblog.com/2018/08/cloud-functions-for-firebase-config-node-8-timeout-memory-region.html
So I believe this warning can truly be ignored...
There are several tools listed in the answers to this question
For Windows I just used nvmw successfully to accomplish this same task.
You will get the nvm here
After installation of nvm.
just use this command
"nvm install 8.9.1 64bit" you can use any version here or 64bit 32bit according to your system config
after that installation use
"nvm use 8.9.1"

How to load the .NET runtime as a node.js module?

I'm using the latest node.js for Windows x86.
I tried to use the node-sharp package from github.
It does compile, but when I load it into the node.js process (via require('./Sharp')),
The rather strange error: Error: no error, cannot load the module C:\path\to\module\Sharp.node occurs.
Has anyone also tried to use this library?
Actually, a better alternative is Edge.js, it is more stable and works now both on Linux and Windows

Resources