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


Monday, October 7, 2019

The file is locked by NET Core Host error

Error MSB3027 Could not copy "obj\Debug\netcoreapp3.0\Project.Tests.dll" to "bin\Debug\netcoreapp3.0\Project.Tests.dll". Exceeded retry count of 10. Failed. The file is locked by: ".NET Core Host (35124)" Project.Tests C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 4206

Open task manager, find the Visual Studio process, like in the image below.
Locate the sub process .NET Core Host and terminate it.
This solved the building problem with me.


It could appear separately as well