Tuesday, December 3, 2019

node-gyp build errors

If you get npm errors like:

node_modules\crypt3\crypt3.cc(5,10): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory  node_modules\crypt3\build\crypt3.vcxproj

Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 

There are so many articles about resolving node-gyp errors. The one that worked for me and the easiest is

npm install --global --production windows-build-tools

From:
https://github.com/nodejs/node-gyp#on-windows

https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules