From ab653cae3315889b39d4eece74c9ba2ae0a23f55 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 16 Nov 2020 12:20:29 +0000 Subject: [PATCH] Docs: use of N-API removes Electron-specific binaries Clarify Lambda deployment for Windows/macOS users --- docs/install.md | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/docs/install.md b/docs/install.md index 0bfade7c..f02e2beb 100644 --- a/docs/install.md +++ b/docs/install.md @@ -147,10 +147,18 @@ The binaries in the `node_modules` directory of the [deployment package](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html) must be for the Linux x64 platform. -On machines other than Linux x64, such as macOS and Windows, run the following: +When building your deployment package on machines other than Linux x64 (glibc), +run the following commands: +macOS: ```sh rm -rf node_modules/sharp +SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux sharp +``` + +Windows: +```sh +rmdir /s /q node_modules/sharp npm install --arch=x64 --platform=linux sharp ``` @@ -164,20 +172,6 @@ docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install sharp To get the best performance select the largest memory available. A 1536 MB function provides ~12x more CPU time than a 128 MB function. -## Electron - -Electron provides versions of the V8 JavaScript engine -that are incompatible with Node.js. -To ensure the correct binaries are used, run the following: - -```sh -npm install -npx electron-rebuild -``` - -Further help can be found at -[https://electronjs.org/docs/tutorial/using-native-node-modules](https://electronjs.org/docs/tutorial/using-native-node-modules) - ## Worker threads The main thread must call `require('sharp')`