Skip to content

Commit d5d5a3c

Browse files
committed
Added 'Mocking and node-gyp' section to README
1 parent 0e36f23 commit d5d5a3c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,30 @@ speculate --name=my-cool-api
329329
```
330330

331331
This is useful if you are using private NPM packages which start with an `@`.
332+
333+
334+
### Mocking and node-gyp
335+
336+
[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.
337+
338+
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.
339+
340+
Make sure your have the a build dependency on: `nodejs-devel`. This places the node header files in `/usr/include/node`:
341+
342+
```json
343+
{
344+
"spec": {
345+
"buildRequires": [
346+
"nodejs-devel"
347+
]
348+
}
349+
}
350+
```
351+
352+
Then add the following line to `/etc/mock/site-defaults.cfg`:
353+
354+
```
355+
config_opts['environment']['npm_config_nodedir'] = '/usr'
356+
```
357+
358+
This will tell node-gyp where to find the node header files on your system.

0 commit comments

Comments
 (0)