profile
viewpoint

Ask questionsGyp is failing to build

<!-- Thank you for reporting an issue. The more information you can give us, the better the chance we can fix your problem.

This issue tracker is for issues with node-gyp, if you have an issue installing a specific module, please file an issue on that module's issue tracker (npm issues modulename). -->

  • Node Version: 12.2.0
  • Platform: Windows 10, Version 10.0.17763
  • Compiler: 'msbuild' is not recognized as an internal or external command, operable program or batch file. 'cl' is not recognized as an internal or external command, operable program or batch file.(?)
  • Module: erlpack and bufferutils

<details><summary>Verbose output (from npm or node-gyp):</summary>

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'bufferutil',
1 verbose cli   'erlpack'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.2.0
4 verbose npm-session a965103cda3bfe52
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/bufferutil 202ms (from cache)
8 http fetch GET 304 https://registry.npmjs.org/erlpack 203ms (from cache)
9 silly pacote tag manifest for bufferutil@latest fetched in 217ms
10 silly pacote tag manifest for erlpack@latest fetched in 205ms
11 timing stage:loadCurrentTree Completed in 272ms
12 silly install loadIdealTree
13 silly install cloneCurrentTreeToIdealTree
14 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
15 silly install loadShrinkwrap
16 timing stage:loadIdealTree:loadShrinkwrap Completed in 13ms
17 silly install loadAllDepsIntoIdealTree
18 silly resolveWithNewModule bufferutil@4.0.1 checking installable status
19 silly resolveWithNewModule erlpack@0.1.2 checking installable status
20 http fetch GET 304 https://registry.npmjs.org/node-gyp-build 42ms (from cache)
21 silly pacote range manifest for node-gyp-build@~3.7.0 fetched in 45ms
22 silly resolveWithNewModule node-gyp-build@3.7.0 checking installable status
23 http fetch GET 304 https://registry.npmjs.org/nan 47ms (from cache)
24 silly pacote range manifest for nan@^2.1.0 fetched in 50ms
25 silly resolveWithNewModule nan@2.13.2 checking installable status
26 http fetch GET 304 https://registry.npmjs.org/bindings 72ms (from cache)
27 silly pacote range manifest for bindings@^1.2.1 fetched in 73ms
28 silly resolveWithNewModule bindings@1.5.0 checking installable status
29 http fetch GET 304 https://registry.npmjs.org/file-uri-to-path 40ms (from cache)
30 silly pacote version manifest for file-uri-to-path@1.0.0 fetched in 42ms
31 silly resolveWithNewModule file-uri-to-path@1.0.0 checking installable status
32 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 178ms
33 timing stage:loadIdealTree Completed in 196ms
34 silly currentTree discord-bot@1.0.0
34 silly currentTree +-- async-limiter@1.0.0
34 silly currentTree +-- bufferutil@4.0.1
34 silly currentTree +-- discord.js@11.5.0
34 silly currentTree +-- long@4.0.0
34 silly currentTree +-- node-gyp-build@3.7.0
34 silly currentTree +-- prism-media@0.0.3
34 silly currentTree +-- snekfetch@3.6.4
34 silly currentTree +-- tweetnacl@1.0.1
34 silly currentTree `-- ws@6.2.1
35 silly idealTree discord-bot@1.0.0
35 silly idealTree +-- async-limiter@1.0.0
35 silly idealTree +-- bindings@1.5.0
35 silly idealTree +-- bufferutil@4.0.1
35 silly idealTree +-- discord.js@11.5.0
35 silly idealTree +-- erlpack@0.1.2
35 silly idealTree +-- file-uri-to-path@1.0.0
35 silly idealTree +-- long@4.0.0
35 silly idealTree +-- nan@2.13.2
35 silly idealTree +-- node-gyp-build@3.7.0
35 silly idealTree +-- prism-media@0.0.3
35 silly idealTree +-- snekfetch@3.6.4
35 silly idealTree +-- tweetnacl@1.0.1
35 silly idealTree `-- ws@6.2.1
36 silly install generateActionsToTake
37 timing stage:generateActionsToTake Completed in 7ms
38 silly diffTrees action count 5
39 silly diffTrees add file-uri-to-path@1.0.0
40 silly diffTrees add bindings@1.5.0
41 silly diffTrees update bufferutil@4.0.1
42 silly diffTrees add nan@2.13.2
43 silly diffTrees add erlpack@0.1.2
44 silly decomposeActions action count 42
45 silly decomposeActions fetch file-uri-to-path@1.0.0
46 silly decomposeActions extract file-uri-to-path@1.0.0
47 silly decomposeActions preinstall file-uri-to-path@1.0.0
48 silly decomposeActions build file-uri-to-path@1.0.0
49 silly decomposeActions install file-uri-to-path@1.0.0
50 silly decomposeActions postinstall file-uri-to-path@1.0.0
51 silly decomposeActions finalize file-uri-to-path@1.0.0
52 silly decomposeActions refresh-package-json file-uri-to-path@1.0.0
53 silly decomposeActions fetch bindings@1.5.0
54 silly decomposeActions extract bindings@1.5.0
55 silly decomposeActions preinstall bindings@1.5.0
56 silly decomposeActions build bindings@1.5.0
57 silly decomposeActions install bindings@1.5.0
58 silly decomposeActions postinstall bindings@1.5.0
59 silly decomposeActions finalize bindings@1.5.0
60 silly decomposeActions refresh-package-json bindings@1.5.0
61 silly decomposeActions unbuild bufferutil@4.0.1
62 silly decomposeActions remove bufferutil@4.0.1
63 silly decomposeActions fetch bufferutil@4.0.1
64 silly decomposeActions extract bufferutil@4.0.1
65 silly decomposeActions preinstall bufferutil@4.0.1
66 silly decomposeActions build bufferutil@4.0.1
67 silly decomposeActions install bufferutil@4.0.1
68 silly decomposeActions postinstall bufferutil@4.0.1
69 silly decomposeActions finalize bufferutil@4.0.1
70 silly decomposeActions refresh-package-json bufferutil@4.0.1
71 silly decomposeActions fetch nan@2.13.2
72 silly decomposeActions extract nan@2.13.2
73 silly decomposeActions preinstall nan@2.13.2
74 silly decomposeActions build nan@2.13.2
75 silly decomposeActions install nan@2.13.2
76 silly decomposeActions postinstall nan@2.13.2
77 silly decomposeActions finalize nan@2.13.2
78 silly decomposeActions refresh-package-json nan@2.13.2
79 silly decomposeActions fetch erlpack@0.1.2
80 silly decomposeActions extract erlpack@0.1.2
81 silly decomposeActions preinstall erlpack@0.1.2
82 silly decomposeActions build erlpack@0.1.2
83 silly decomposeActions install erlpack@0.1.2
84 silly decomposeActions postinstall erlpack@0.1.2
85 silly decomposeActions finalize erlpack@0.1.2
86 silly decomposeActions refresh-package-json erlpack@0.1.2
87 silly install executeActions
88 silly doSerial global-install 42
89 verbose correctMkdir C:\Users\DavidM\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
90 verbose lock using C:\Users\DavidM\AppData\Roaming\npm-cache\_locks\staging-c29ef0a37584848e.lock for C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging
91 silly doParallel extract 5
92 silly extract file-uri-to-path@1.0.0
93 silly extract bindings@1.5.0
94 silly extract bufferutil@4.0.1
95 silly extract nan@2.13.2
96 silly extract erlpack@0.1.2
97 silly tarball trying file-uri-to-path@1.0.0 by hash: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
98 silly tarball trying bindings@^1.2.1 by hash: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
99 silly tarball trying bufferutil@latest by hash: sha512-xowrxvpxojqkagPcWRQVXZl0YXhRhAtBEIq3VoER1NH5Mw1n1o0ojdspp+GS2J//2gCVyrzQDApQ4unGF+QOoA==
100 silly tarball trying nan@^2.1.0 by hash: sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==
101 silly tarball trying erlpack@latest by hash: sha1-zx9PdV0HKOvC0RsuPJK9Lag0UU4=
102 silly extract bindings@^1.2.1 extracted to C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging\bindings-9c3a0c13 (46ms)
103 silly extract file-uri-to-path@1.0.0 extracted to C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging\file-uri-to-path-5b1b7d65 (52ms)
104 silly extract bufferutil@latest extracted to C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging\bufferutil-0934ce38 (74ms)
105 silly extract nan@^2.1.0 extracted to C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging\nan-22b80c2c (86ms)
106 timing audit submit Completed in 1717ms
107 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1717ms
108 timing audit body Completed in 1ms
109 silly extract erlpack@latest extracted to C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging\erlpack-3d6ef24b (2150ms)
110 timing action:extract Completed in 2154ms
111 silly doReverseSerial unbuild 42
112 silly unbuild bufferutil@4.0.1
113 info lifecycle bufferutil@4.0.1~preuninstall: bufferutil@4.0.1
114 info lifecycle bufferutil@4.0.1~uninstall: bufferutil@4.0.1
115 verbose unbuild rmStuff bufferutil@4.0.1 from C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules
116 info lifecycle bufferutil@4.0.1~postuninstall: bufferutil@4.0.1
117 timing action:unbuild Completed in 2ms
118 silly doSerial remove 42
119 silly remove C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bufferutil
120 timing action:remove Completed in 8ms
121 silly doSerial move 42
122 silly doSerial finalize 42
123 silly finalize C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\file-uri-to-path
124 silly finalize C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bindings
125 silly finalize C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bufferutil
126 silly finalize C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\nan
127 silly finalize C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\erlpack
128 timing action:finalize Completed in 9ms
129 silly doParallel refresh-package-json 5
130 silly refresh-package-json C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\file-uri-to-path
131 silly refresh-package-json C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bindings
132 silly refresh-package-json C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bufferutil
133 silly refresh-package-json C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\nan
134 silly refresh-package-json C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\erlpack
135 timing action:refresh-package-json Completed in 45ms
136 silly doParallel preinstall 5
137 silly preinstall file-uri-to-path@1.0.0
138 info lifecycle file-uri-to-path@1.0.0~preinstall: file-uri-to-path@1.0.0
139 silly preinstall bindings@1.5.0
140 info lifecycle bindings@1.5.0~preinstall: bindings@1.5.0
141 silly preinstall bufferutil@4.0.1
142 info lifecycle bufferutil@4.0.1~preinstall: bufferutil@4.0.1
143 silly preinstall nan@2.13.2
144 info lifecycle nan@2.13.2~preinstall: nan@2.13.2
145 silly preinstall erlpack@0.1.2
146 info lifecycle erlpack@0.1.2~preinstall: erlpack@0.1.2
147 timing action:preinstall Completed in 1ms
148 silly doSerial build 42
149 silly build file-uri-to-path@1.0.0
150 info linkStuff file-uri-to-path@1.0.0
151 silly linkStuff file-uri-to-path@1.0.0 has C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules as its parent node_modules
152 silly build bindings@1.5.0
153 info linkStuff bindings@1.5.0
154 silly linkStuff bindings@1.5.0 has C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules as its parent node_modules
155 silly build bufferutil@4.0.1
156 info linkStuff bufferutil@4.0.1
157 silly linkStuff bufferutil@4.0.1 has C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules as its parent node_modules
158 silly build nan@2.13.2
159 info linkStuff nan@2.13.2
160 silly linkStuff nan@2.13.2 has C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules as its parent node_modules
161 silly build erlpack@0.1.2
162 info linkStuff erlpack@0.1.2
163 silly linkStuff erlpack@0.1.2 has C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules as its parent node_modules
164 timing action:build Completed in 1ms
165 silly doSerial global-link 42
166 silly doParallel update-linked 0
167 silly doSerial install 42
168 silly install file-uri-to-path@1.0.0
169 info lifecycle file-uri-to-path@1.0.0~install: file-uri-to-path@1.0.0
170 silly install bindings@1.5.0
171 info lifecycle bindings@1.5.0~install: bindings@1.5.0
172 silly install bufferutil@4.0.1
173 info lifecycle bufferutil@4.0.1~install: bufferutil@4.0.1
174 verbose lifecycle bufferutil@4.0.1~install: unsafe-perm in lifecycle true
175 verbose lifecycle bufferutil@4.0.1~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bufferutil\node_modules\.bin;C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Git\cmd;C:\Program Files\emacs\bin;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Users\DavidM\.cargo\bin;C:\Users\DavidM\AppData\Local\Microsoft\WindowsApps;;C:\Users\DavidM\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\DavidM\AppData\Roaming\npm;C:\texlive\2019\bin\win32
176 verbose lifecycle bufferutil@4.0.1~install: CWD: C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\bufferutil
177 silly lifecycle bufferutil@4.0.1~install: Args: [ '/d /s /c', 'node-gyp-build' ]
178 silly lifecycle bufferutil@4.0.1~install: Returned: code: 0  signal: null
179 silly install nan@2.13.2
180 info lifecycle nan@2.13.2~install: nan@2.13.2
181 silly install erlpack@0.1.2
182 info lifecycle erlpack@0.1.2~install: erlpack@0.1.2
183 verbose lifecycle erlpack@0.1.2~install: unsafe-perm in lifecycle true
184 verbose lifecycle erlpack@0.1.2~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\erlpack\node_modules\.bin;C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Git\cmd;C:\Program Files\emacs\bin;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Users\DavidM\.cargo\bin;C:\Users\DavidM\AppData\Local\Microsoft\WindowsApps;;C:\Users\DavidM\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\DavidM\AppData\Roaming\npm;C:\texlive\2019\bin\win32
185 verbose lifecycle erlpack@0.1.2~install: CWD: C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\erlpack
186 silly lifecycle erlpack@0.1.2~install: Args: [ '/d /s /c', 'node-gyp rebuild' ]
187 silly lifecycle erlpack@0.1.2~install: Returned: code: 7  signal: null
188 info lifecycle erlpack@0.1.2~install: Failed to exec install script
189 timing action:install Completed in 2951ms
190 verbose unlock done using C:\Users\DavidM\AppData\Roaming\npm-cache\_locks\staging-c29ef0a37584848e.lock for C:\Users\DavidM\Desktop\Projects\discord-bot\node_modules\.staging
191 timing stage:rollbackFailedOptional Completed in 65ms
192 timing stage:runTopLevelLifecycles Completed in 5733ms
193 silly saveTree discord-bot@1.0.0
193 silly saveTree +-- bufferutil@4.0.1
193 silly saveTree | `-- node-gyp-build@3.7.0
193 silly saveTree +-- discord.js@11.5.0
193 silly saveTree | +-- long@4.0.0
193 silly saveTree | +-- prism-media@0.0.3
193 silly saveTree | +-- snekfetch@3.6.4
193 silly saveTree | +-- tweetnacl@1.0.1
193 silly saveTree | `-- ws@6.2.1
193 silly saveTree |   `-- async-limiter@1.0.0
193 silly saveTree `-- erlpack@0.1.2
193 silly saveTree   +-- bindings@1.5.0
193 silly saveTree   | `-- file-uri-to-path@1.0.0
193 silly saveTree   `-- nan@2.13.2
194 warn discord.js@11.5.0 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
195 warn discord.js@11.5.0 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
196 warn discord.js@11.5.0 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
197 warn discord.js@11.5.0 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
198 warn discord.js@11.5.0 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
199 warn discord.js@11.5.0 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
200 warn discord-bot@1.0.0 No description
201 warn discord-bot@1.0.0 No repository field.
202 verbose stack Error: erlpack@0.1.2 install: `node-gyp rebuild`
202 verbose stack Exit status 7
202 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
202 verbose stack     at EventEmitter.emit (events.js:196:13)
202 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
202 verbose stack     at ChildProcess.emit (events.js:196:13)
202 verbose stack     at maybeClose (internal/child_process.js:1011:16)
202 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:268:5)
203 verbose pkgid erlpack@0.1.2
204 verbose cwd C:\Users\DavidM\Desktop\Projects\discord-bot
205 verbose Windows_NT 10.0.17763
206 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bufferutil" "erlpack"
207 verbose node v12.2.0
208 verbose npm  v6.9.0
209 error code ELIFECYCLE
210 error errno 7
211 error erlpack@0.1.2 install: `node-gyp rebuild`
211 error Exit status 7
212 error Failed at the erlpack@0.1.2 install script.
212 error This is probably not a problem with npm. There is likely additional logging output above.
213 verbose exit [ 7, true ]

</details>

<!-- Any further details --> So when trying to install bufferutils and erlpack modules for the discord.js module, I get the above error via log above. I am not sure if this is due to something missing in the configuration, or if its because the winows-build-tools module is misconfigured somehow (I followed the instructions to install them directly from the README). Let me know

nodejs/node-gyp

Answer questions joaocgreis

node-gyp v5.0.0 is out with Visual Studio 2019 support. It's not yet integrated into npm so it has to be installed manually. This should do it (only need to be run once):

<details> <summary>Windows Command Prompt</summary>

npm install --global node-gyp@latest
for /f "delims=" %P in ('npm prefix -g') do npm config set node_gyp "%P\node_modules\node-gyp\bin\node-gyp.js"

</details> <details> <summary>Powershell</summary>

npm install --global node-gyp@latest
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}

</details><br>

That is, install node-gyp globally and make the npm config variable node_gyp point to node-gyp.js.

<details> <summary>How to undo this after node-gyp is integrated into npm</summary>

npm uninstall --global node-gyp
npm config delete node_gyp

</details><br>

useful!
source:https://uonfu.com/
Github User Rank List