Skip to content

Commit 1e0b7c6

Browse files
committed
Added 'Mocking and node-gyp' section to README
1 parent 6759026 commit 1e0b7c6

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,30 @@ Running rpmbuild on an npm package with a hyphen in its version number throws an
350350
"replaceHyphens": true
351351
}
352352
}
353-
```
353+
```
354+
355+
### Mocking and node-gyp
356+
357+
[Mock](https://github.com/rpm-software-management/mock) is a really useful tool to ensure that your RPM builds in a clean environment, without accidentally depending on something your system that you havn't added to the `require` list.
358+
359+
While the RPM is being built by `mock`, it does not have any access to the Internet. This is good because it ensures that you get consistent builds. It also means the build won't fail, if a server outside of your control is offline. However it can cause node-gyp to fail, if it can't find the node header files on your system.
360+
361+
If you are using [NodeSource](https://github.com/nodesource/distributions), then you will need to make sure your have a build dependency on: `nodejs-devel`. This places the node header files in `/usr/include/node`:
362+
363+
```json
364+
{
365+
"spec": {
366+
"buildRequires": [
367+
"nodejs-devel"
368+
]
369+
}
370+
}
371+
```
372+
373+
Then add the following line to `/etc/mock/site-defaults.cfg`:
374+
375+
```
376+
config_opts['environment']['npm_config_nodedir'] = '/usr'
377+
```
378+
379+
This will tell node-gyp where to find the node.js header files on your system.

0 commit comments

Comments
 (0)