Azure Functions func host start Error: "The gRPC binary module was not installed." - npm

yesterday the VS Code informed me to update azure-functions-core-tools and after updating it, this error was displayed to me after I ran "func host start" :
Couldn't require bundle, falling back to Worker.js. Error: The gRPC binary module was not installed.This may be fixed by running "npm rebuild"
any idea on how to fix this?I tried npm rebuild and it does not worked.

This error often indicates that the grpc library was installed for a platform that is different from the one it is running on. The solution is to run npm install with extra arguments that describe the platform the library will run on. These options are described in the node-pre-gyp README.
For example, to install grpc for use on Node 10.0.0 on a 64-bit Linux that is not Alpine Linux, you can use the following command:
npm install --target=10.0.0 --target_arch=x64 --target_platform=linux --target_libc=glibc
Note: the target_libc option should be omitted for platforms other than Linux.

after 2 hours, installing x86 version of azure-functions-core-tools resolved the error. but this may not be the best solution.

Related

Override Platform for Yarn 2 install

I have a number of docker containers which have a volume shared with my local filesystem. I am trying to install the package esbuild, which has different versions for linux and darwin OS's. When I run yarn install locally, it installs the wrong package version, and ignores the correct version, no matter how I declare it, as it detects my darwin platform and assumes I don't need the linux version:
esbuild-linux-64#npm:0.14.14 The linux-x64 architecture is incompatible with this module, link skipped.
I can connect to the container and run the install from there, and it installs the correct esbuild-linux-64 version in that case, but the install/build runs prohibitively slower because the container is much smaller than my machine.
I have looked through most of the Yarn documentation, and it seems they got rid of a couple of methods in Yarn Classic which allowed you to override the platform, or at least ignore incompatible package detection.
In Yarn v2, there is a new config setting, supportedArchitectures:, set in the .yarnrc.yml file, but it seems the yarn link step still ignores any incompatible packages which were included in supportedArchitectures.
Thanks for any help!

npm install fail with some package not found on some server

I am on different servers and run npm install
One server is ok. Another failed showing below error:
no matching version found for es-abstract#1.14.0
I tried npm ci. Same deal.
Then I did npm install es-abstract-1.14.0.tgz
But the size node_modules/ are different. I am using du -shc --apparent-size node_modules/ to ignore the sparse files within the folder. Why?
Could I accept that this is the network issue of the failed server? And just keep doing this? I mean, is the installation still going to be ok in this way?
At the time that this answer was written, there are 33 release versions for es-abstract on github, but only 32 release versions are listed on its npm registry. The missing version in the registry is 1.14.0.
Perhaps on one of your servers, you had this package cached (maybe it was previously listed on the NPM registry?, or maybe from downloading it from github?), and on the other server you did not have this package cached.
I had this same error message when trying to npm install a project from github.
In my situation, the es-abstract package was not explicitly listed in the package.json file, but it was a dependency of another package. Therefore I explicitly added it with the next highest version listed on the registry, and it worked.
e.g.
"dependencies": {
"es-abstract": "1.14.1",
...
Just a guess, but maybe 1.14.0 used to be listed on the registry, but now it's not?

How can I install NODE_MODULE_VERSION 46

How can I install a Node.js version using NODE_MODULE_VERSION 46? I keep running into a NODE_MODULE_VERSION mismatch, and recompiling hasn't helped so switching node versions might be easier.
Basically, I keep coming across this:
Warning: The module '/home/cwaugh/workspaces/myproject/build/Release/addon.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`). Use --force to continue.
So far, I've tried using n to change to different versions (one of my dependencies requires 4.9.1 or below), but that doesn't seem to change the NODE_MODULE_VERSION as recognized by the warning.
I've also tried recompiling:
I've tried deleting node_modules and running npm install again. (this error looks like it's coming from the project root, but it never worked for anything in the node_modules folder either)
node-gyp configure --target=4.9.1 && node-gyp build --target=4.9.1. I got the idea from here, and hoped I'd have better luck than mxcd.
node-pre-gyp rebuild. I saw this, and thought it might work for me.
This works on another, older computer running a vagrant image. Unfortunately, vagrant isn't working on the new computer either, so I've been trying from scratch. Sometimes, I wonder if it's because I'm using Ubuntu 18.04. The server's can't seem to go past 16.04 when they run our docker image.
I GOT IT!
It turns out I was getting different versions from node and nodejs
$ node --version
v4.9.1
$ nodejs --version
v8.10.0
I upgrade to node v8.10.0, redo everything, and the error's gone!
sudo npm install -g n
sudo n 8.10.0
rm -rf node_modules
npm install
node-gyp clean
node-gyp configure
node-gyp build
grunt build
grunt start
# No more NODE_MODULE_VERSION error
I tried uninstalling nodejs (since this it's been replaced by just "node"), but node-grunt-cli requires it. I'm guessing that grunt uses nodejs instead of node to check its version, causing the error. The Ubuntu repositories have Grunt v0.4.5, while Grunt stable is at v1.0.3, so it's possible a newer version of grunt would also solve this problem.
The solution didn't work for me since I had just one node version (10).
What was happening in my project, was that the package.json was pulled from the remote repository with an old version package.
At the moment of installing node modules locally (using yarn), it would download up-to-date dependencies, creating incompatibility.
After trying several solutions, what finally worked for me was picking the specific package that was giving me headache (login-funcs-nodejs) and run:yarn upgrade login-funcs-nodejs --latest

Apache Cordova VS Community 2015 - Run Dependency Checker Fails

Apache Cordova Dependency Checker fails in VS Community 2015. It was previously working on this computer until I ran several VS and 3rd party tools updates. Here's what I've done to try to resolve the issue:
Installed VS / Apache Cordova (no error messages displayed) following article https://taco.visualstudio.com/en-us/docs/install-vs-tools-apache-cordova/
Run Apache Cordova Dependency Checker but VS freezes with the error message - VS 2015 has stopped working, windows will try to restart the program.
I restarted VS and cleared Cordova cache, checked environment variables (all good), then tried Apache Cordova Dependency Checker with the same freeze result.
I tried to update Apache Cordova with the fix option (no error messages) but received the same freeze results.
I completely uninstalled Apache Cordova, 3rd party tools (following article https://support.microsoft.com/en-us/kb/3016536), and VS community and then reinstalled them (no error messages) but received the same freeze results.
I installed Apache Cordova on another computer and the dependency checker phonegap app... worked. Unfortunately that's not a computer that I have access to.
What else can I do to resolve the Apache Cordova installation issue?
Thanks for any help,
Mike
Since my original post, I've had to resolve Visual Studio, Ionic, Cordova, Phonegap, plugin... environment issue several times. I've found the below works best:
Ensure platform matches plugin requirements, see platform in config.xml e.g. 6.1.1
Uninstall, reinstall latest jdk (adobe)
Clear MEF Cache - download the tool and follow instructions
Download/install latest node.js
Run the following from the command line:
Clear cache: Npm cache clean
Install latest npm: npm install -g npm
Uninstall cordova: Npm uninstall -g cordova
Reinstall cordova: Npm install –g cordova (note, this took 5+ tries to complete without errors. No other changes were made between runs. Not sure
why. Found others complaining about the same issue.)
Remove Android platform: Cordova platform remove android
Install Cordova platform add android#6.X.X (Note, as of 4/20/17 cordova and android compatibility issue. Build error - unable to find installed version of gradle. resolved by running (npm install -g cordova#6.4.0) and (cordova platform add android#6.1.2). Addt'l build errors, resolved by updating components in Android SDK Manager)
Uninstall/Reinstall plugins from the command line. For example:
cordova plugin remove phonegap-plugin-push
cordova plugin add phonegap-plugin-push variable SENDER_ID="YourID#"
npm install bower -g
Restart Visual Studio - Verify plugins were installed via config.xml
Install Ionic:
npm uninstall -g ionic
npm install -g ionic (note: to install specific version, npm install -g ionic#2.2.3)
$ ionic platform add ios
$ ionic platform add android (note: redundant, already added above)
I recommend putting as much of this as possible in a batch file with a pause between commands. Verify each command was successful, if not press ctrl+break at the pause to term the batch file early. The batch file is an easy way to restore your environment when everything breaks again. Stuff happens!
I also started using a VM (oracle virtualbox) for my development environment. That way I can backup my environment before making changes and easily restore. Don't forget to upload to GIT on a daily basis. GIT and VMs are my lifesavers.
Cool NPM commands:
npm list (lists all installed packages)
npm prune (removes packages not depended on by your project according to your package.json)
npm outdated (tells you which installed packages are outdated with respect to what is current in the npm registry but allowable by the version definition in your package.json. Make sure all up-to-date)
Please feel free to add/make suggestions to the above list.
-Mike

npm not recognised after installing Heroku Toolbelt

I've installed Heroku Toolbelt (https://toolbelt.heroku.com/) on a Windows 7 system.
I've followed the tutorial up to here: https://devcenter.heroku.com/articles/getting-started-with-nodejs#declare-app-dependencies
When I run the command npm install it gives the following error:
'npm' is not recognized as an internal or external command, operable program or batch file.
I understand this means it can't find/execute npm. But this is going from Heroku's own tutorial/documentation, in sequence, and doesn't say you need to install anything else to get this working. When I go to the npm website (https://www.npmjs.com/) it also says:
The npm command-line tool is bundled with Node.js. If you have it installed, then you already have npm too.
Something is wrong with this!
Try to reinstall nodejs. Alternatively, you can install nvm for windows, which is a version manager for nodejs. It's pretty useful and easy to install. Check it out at https://github.com/coreybutler/nvm-windows