I got this error while running a yarn build, the output says it's a bug in node-gyp.
Another issue is that it exited with a 0 error code, I suppose that's an issue with yarn and not here? So the rest of my build script continued instead of failing.
Verbose output (from npm or node-gyp):
yarn install v1.9.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0/216
(node:10986) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error .../node_modules/sharp: Command failed.
Exit code: 7
Command: node-gyp rebuild
Arguments:
Directory: .../node_modules/sharp
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn ENOMEM
gyp ERR! stack at ChildProcess.spawn (internal/child_process.js:358:11)
gyp ERR! stack at Object.spawn (child_process.js:533:9)
gyp ERR! stack at Gyp.spawn (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:180:26)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:334:20
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:155:5)
gyp ERR! System Linux 4.9.0-7-amd64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd .../node_modules/sharp
gyp ERR! node -v v10.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
gyp ERR! stack Error: spawn ENOMEM
Not really a node-gyp bug. The system ran out of memory.
What about the exit code being 0 in the failure case?
Got the identical error on npm install. Makes no sense. This needs to be resolved. I have 32GB RAM, only 15% used.
Getting the same error. Definitely not out of memory.
Can someone explain to me why this got closed? I'm having a similar issue and I can definitely say it's not a memory issue.
Are you using [email protected] like the original post?
@cclauss yup!
Could you please retry with something a bit more modern?
https://github.com/nodejs/node-gyp/releases
@cclauss I would if I could. I found a workaround to the issue by getting an older version of node. node 10 specifically.
Most helpful comment
Can someone explain to me why this got closed? I'm having a similar issue and I can definitely say it's not a memory issue.