cant do npm install - Macro definition of snprintf conflicts - node.js

I'm trying to start my heroku nodejs application at brand new computer. I don't have any problems with this application at older computer, but here I'm receiving:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\OEM\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\OEM\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\programowanie\naszatrasa\node_modules\mmmagic
gyp ERR! node -v v5.1.1
gyp ERR! node-gyp -v v3.2.0
gyp ERR! not ok
previous logs contain logs such as:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration (compiling sourc
e file ..\..\..\deps\libmagic\src\apprentice.c) [C:\programowanie\naszatrasa\node_modules\mmmagic\build\deps\libmagic\libmagic.vcxproj]
I have tried previous versions of npm and node but had problems with node-gyp and Visual Studio 2015 (which I have installed)

Related

MSBUILD : Configuration error MSB4148 "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" has zero length

I'm trying yo install electron-chromedrive by using yarn, so by doing this command:
yarn add --dev electron-chromedriver --network-timeout 100000
But it gives the following error:
MSBUILD : Configuration error MSB4148 "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" has zero length
Precisely:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\vipul\AppData\Roaming\nvm\v16.14.2\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:526:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.19043
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\vipul\software\desktop\webapp\src
gyp ERR! node -v v16.14.2
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
error Command failed with exit code 1.
How can I solve it?
I've solved the issue by removing the following MSBUILD keys in the registory editor:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\4.0
And after, that I've reinstalled Visual Studio again.

Error at rebuild SQLite3 for a Electron app

I am trying to install sqlite3 to make an app in Electron over Windows. I put in my package.json:
"rebuild": "electron-rebuild -f -w sqlite3"
When I run:
npm run rebuild
I get this error:
Error: The projects of this solution will be compiled one at a time. To enable compilation in parallel, add the "/ m" switch.
D:\WindowsDev\CopyWatcher\node_modules\sqlite3\build\deps\action_before_build.vcxproj(20,3): error MSB4019: The imported project "D: \ Microsoft.Cpp.Default.props" can not be found. Make sure that the path of the <Import> declaration is correct and that the file is on the disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\WindowsDev\CopyWatcher\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\WindowsDev\\CopyWatcher\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=D:\\WindowsDev\\CopyWatcher\\node_modules\\sqlite3\\lib\\binding\\electron-v2.0-win32-x64" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.2/{toolset}/" "--package_name=electron-v2.0-win32-x64.tar.gz"
gyp ERR! cwd D:\WindowsDev\CopyWatcher\node_modules\sqlite3
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
I install Visual Studio Developer Tools 2015 and sqlite3 module works well!

electron-rebuild grpc build failure

When i try to run electron-rebuild to get grpc working for Electron, i get the below error. When my colleague does the same thing, no error. We are unable to determine what the difference is in our environments. Both Windows 10 64, node64, VS2015 package 3, "electron": "1.6.6", "electron-rebuild": "^1.5.7"
Any ideas? The error isn't telling me much.
C:\Dev\Projects\Electron\PAT\client>npm run rebuild
> # rebuild C:\Dev\Projects\Electron\PAT\client
> electron-rebuild -m ./app
× Rebuild Failed
An unhandled error occurred inside electron-rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
WINDOWS_BUILD_WARNING
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073741515. [C:\Dev\Projects\Electron\PAT\client\app\node_modules\grpc\build\WINDOWS_BUILD_WARNING.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Dev\Projects\Electron\PAT\client\node_modules\node-gyp\lib\build.js:285:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:194:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Dev\\Projects\\Electron\\PAT\\client\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.6.6" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=grpc_node" "--module_path=C:\\Dev\\Projects\\Electron\\PAT\\client\\app\\node_modules\\grpc\\src\\node\\extension_binary" "--host=https://storage.googleapis.com/" "--remote_path=grpc-precompiled-binaries/node/{name}/v1.2.3" "--package_name=electron-v1.6-win32-x64.tar.gz"
gyp ERR! cwd C:\Dev\Projects\Electron\PAT\client\app\node_modules\grpc
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Failed with exit code: 1
Error: Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
WINDOWS_BUILD_WARNING
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073741515. [C:\Dev\Projects\Electron\PAT\client\app\node_modules\grpc\build\WINDOWS_BUILD_WARNING.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Dev\Projects\Electron\PAT\client\node_modules\node-gyp\lib\build.js:285:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:194:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Dev\\Projects\\Electron\\PAT\\client\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.6.6" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=grpc_node" "--module_path=C:\\Dev\\Projects\\Electron\\PAT\\client\\app\\node_modules\\grpc\\src\\node\\extension_binary" "--host=https://storage.googleapis.com/" "--remote_path=grpc-precompiled-binaries/node/{name}/v1.2.3" "--package_name=electron-v1.6-win32-x64.tar.gz"
gyp ERR! cwd C:\Dev\Projects\Electron\PAT\client\app\node_modules\grpc
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Failed with exit code: 1
at SafeSubscriber._error (C:\Dev\Projects\Electron\PAT\client\node_modules\spawn-rx\lib\src\index.js:262:84)
at SafeSubscriber.__tryOrUnsub (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:236:16)
at SafeSubscriber.error (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:197:26)
at Subscriber._error (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:128:26)
at Subscriber.error (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:102:18)
at MapSubscriber.Subscriber._error (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:128:26)
at MapSubscriber.Subscriber.error (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:102:18)
at SafeSubscriber._next (C:\Dev\Projects\Electron\PAT\client\node_modules\spawn-rx\lib\src\index.js:236:65)
at SafeSubscriber.__tryOrUnsub (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:236:16)
at SafeSubscriber.next (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:185:22)
at Subscriber._next (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:125:26)
at Subscriber.next (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:89:18)
at ReduceSubscriber._complete (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\operator\reduce.js:119:30)
at ReduceSubscriber.Subscriber.complete (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\Subscriber.js:114:18)
at MergeAllSubscriber.notifyComplete (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\operator\mergeAll.js:105:30)
at InnerSubscriber._complete (C:\Dev\Projects\Electron\PAT\client\node_modules\rxjs\InnerSubscriber.js:30:21)
The error you are looks like the same one that was reported in this GitHub issue. Basically, there's an action in gRPC's binding.gyp file that doesn't work correctly in the Windows 10 console.
Many years later, came across this with a similar error. Turned out being an issue with the cli I was using. Gitbash and command prompt both failed, but powershell as admin worked. For anyone else suffering, I hope you find this and build successfully.

npm install irc failing

I've been trying to install the node-irc library for Node.Js.
I seem to be running into this issue and not sure why. I installed a fresh copy of Node.JS (version 4.22), I have .NET Framework 2.0 SDK installed on Windows, and Python 2.7.10
Here is the error:
C:\Users\Owner\Desktop\Test\node_modules\irc\node_modules\node-icu-charset-detector>if not defined npm_config_node_gyp (node "D:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build,please add the "/m" switch.
d:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(13): fatal error C1083: Cannot open include file: 'windows.h':No such file or directory
[C:\Users\Owner\Desktop\Test\node_modules\irc\node_modules\node-icu-charset-detector\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "D:\Program Files (x86)\nodejs\node.exe" "D:\Program Files(x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Owner\Desktop\Test\node_modules\irc\node_modules\node-icu-charset-detector
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
iconv#2.1.11 install C:\Users\Owner\Desktop\Test\node_modules\irc\node_modules\
iconv
node-gyp rebuild

npm install socket.io stack Error: `msbuild` failed with exit code: 1

I'm going crazy with the installation of socket.io. I tried various solutions around the net but every time I get an error.
I followed the instructions at this link about node-gyp.
I have windows7 professional 64 bit.
here is what I get from the shell
C:\Users\utente\Projects\webrtc>npm install socket.io
> utf-8-validate#1.2.1 install C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
/
C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules
\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(507,5): error MSB8008: Specified platform toolset (v110) is not installed or invalid. Please make sure that a
supported PlatformToolset value is selected. [C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\validation.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\ProgramFiles\nodejs\node_modules\npm\node_modules\node- gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
> bufferutil#1.2.1 install C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gypbin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(507,5): error MSB8008: Specified platform toolset (v110) is not installed or invalid. Please make sure that a
supported PlatformToolset value is selected. [C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate#1.2.1
> utf-8-validate#1.2.1 install C:\Users\utente\Projects\webrtc\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
.....
.....
.....
any suggestions?
thanks

Resources