Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'Mocking and node-gyp' section to README #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,30 @@ Running rpmbuild on an npm package with a hyphen in its version number throws an
"replaceHyphens": true
}
}
```
```

### Mocking and node-gyp

[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.

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.

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`:

```json
{
"spec": {
"buildRequires": [
"nodejs-devel"
]
}
}
```

Then add the following line to `/etc/mock/site-defaults.cfg`:

```
config_opts['environment']['npm_config_nodedir'] = '/usr'
```

This will tell node-gyp where to find the node.js header files on your system.