grpc-node/packages/grpc-native-core
Tomas Alabes 2015e3d32c
Updated doc in readme.md
Explaining the option to change the location of the precompiled-binaries. Related to #441 and #117.
2018-07-18 15:49:06 -07:00
..
deps Update usage of modifed core credentials API 2018-06-20 12:43:09 -07:00
ext Properly create slices from utf8 strings. 2018-07-09 22:32:14 +02:00
src Fix generic client interceptor resolution 2018-06-05 11:14:58 -07:00
templates Changes needed for the nanopb dep refactoring work 2018-06-13 17:18:03 -07:00
test Properly create slices from utf8 strings. 2018-07-09 22:32:14 +02:00
tools Split native and cross compilers into two docker images. 2018-05-18 09:44:53 +02:00
.jshintignore Moving files into their new location. 2017-09-12 01:33:18 +02:00
.npmignore Remove some unnecessary files from the native npm package 2017-09-19 11:18:00 -07:00
README.md Updated doc in readme.md 2018-07-18 15:49:06 -07:00
binding.gyp Update usage of modifed core credentials API 2018-06-20 12:43:09 -07:00
build.yaml Update version to 1.12.3 2018-06-08 13:51:58 -07:00
gulpfile.js Increasing mocha timeout to 5s up from 2s. 2018-05-25 19:16:04 +02:00
index.d.ts grpc-native-core: Update CallOptions type to allow custom options (#433) 2018-07-13 10:14:17 -05:00
index.js Add deprecation notice to grpc.load 2018-06-11 15:05:47 -07:00
jsdoc_conf.json Move dependencies around, add gulp target for document generation 2017-09-20 12:39:16 -07:00
package.json Update usage of modifed core credentials API 2018-06-20 12:43:09 -07:00

README.md

npm

Node.js gRPC Library

PREREQUISITES

  • node: This requires node to be installed, version 4.0 or above. If you instead have the nodejs executable on Debian, you should install the nodejs-legacy package.

  • Note: If you installed node via a package manager and the version is still less than 4.0, try directly installing it from nodejs.org.

INSTALLATION

Install the gRPC NPM package

npm install grpc

ABOUT ELECTRON

The official electron documentation recommends to build all of your native packages from source. While the reasons behind this are technically good - many native extensions won't be packaged to work properly with electron - the gRPC source code is fairly difficult to build from source due to its complex nature, and we're also providing working electron pre-built binaries. Therefore, we recommend that you do not follow this model for using gRPC with electron. Also, for the same reason, electron-rebuild will always build from source. We advise you to not use this tool if you are depending on gRPC. Please note that there's not just one way to get native extensions running in electron, and that there's never any silver bullet for anything. The following instructions try to cater about some of the most generic ways, but different edge cases might require different methodologies.

The best to get gRPC to work with electron is to do this, possibly in your postinstall script of your package.json file:

npm rebuild --target=2.0.0 --runtime=electron --dist-url=https://atom.io/download/electron

Note that the 2.0.0 above is the electron runtime version number. You will need to update this every time you go on a different version of the runtime.

If you have more native dependencies than gRPC, and they work better when built from source, you can explicitely specify which extension to build the following way:

npm rebuild --build-from-source=sqlite3 --target=2.0.0 --runtime=electron --dist-url=https://atom.io/download/electron

This way, if you depend on both grpc and sqlite3, only the sqlite3 package will be rebuilt from source, leaving the grpc package to use its precompiled binaries.

BUILD FROM SOURCE

  1. Clone the grpc Git Repository.
  2. Run npm install --build-from-source from the repository root.
  • Note: On Windows, this might fail due to nodejs issue #4932 in which case, you will see something like the following in npm install's output (towards the very beginning):

     ..
     Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
     WINDOWS_BUILD_WARNING
      "..\IMPORTANT: Due to https:\github.com\nodejs\node\issues\4932, to build this library on Windows, you must first remove C:\Users\jenkins\.node-gyp\4.4.0\include\node\openssl"
      ...
      ..
    

    To fix this, you will have to delete the folder C:\Users\<username>\.node-gyp\<node_version>\include\node\openssl and retry npm install

CONFIGURE BINARIES' LOCATION

You can configure the location from which the pre-compiled binaries are downloaded during installation.

npm install --grpc_node_binary_host_mirror=https://your-url.com

Or defining grpc_node_binary_host_mirror in your .npmrc.

API DOCUMENTATION

See the API Documentation.

TESTING

To run the test suite, simply run npm test in the install location.