- Download Node.js from the official website and install Node.js using the downloaded installer.
- Make sure both
npm --versionwork in your Command Prompt.
- Install Node.js as system package.
- Make sure both
npm --versionwork in your Terminal.
- Continuous Integration section in the How-To Guides can help you to install Dredd on CI server.
- To maintain multiple Node.js versions on your computer, check out nvm.
npm install -g dredd
If the second command works, you’re done!
Globally vs locally¶
-g ensures Dredd will be installed “globally”. That means you’ll be able to access it from any directory just by typing
If you work on projects installable by
npm, i.e. projects containing
package.json, you might want to have Dredd installed as a development dependency instead. Just install Dredd by
npm install dredd --save-dev. See
package.json of the Dredd Example repository for inspiration.
- For development, always go with the latest version.
- For testing in CI (what’s CI?), always pin your Dredd version to a specific number and upgrade to newer releases manually (but often!).
Why Am I Seeing Network Errors?¶
In a restricted network (VPN, firewall, proxy) you can see errors similar to the following ones:
npmERR! Cannot read property 'path' of null npmERR!code ECONNRESET npmERR!network socket hang up
Error: Command failed: git config --get remote.origin.url ssh: connect to host github.com port 22: Operation timed out fatal: Could not read from remote repository.
To solve these issues, you need to set your proxy settings for both
$ npm config set proxy "http://proxy.company.com:8080" $ npm config set https-proxy "https://proxy.company.com:8080" $ git config --global http.proxy "http://proxy.company.com:8080" $ git config --global https.proxy "https://proxy.company.com:8080"
git config, make sure you have the port specified even when it’s the standard
:80. Also check out how to set up Dredd to correctly work with proxies.
Why I’m Seeing
The installation process features compilation of some C++ components, which may not be successful. In that case, errors related to
python are printed. However, if
dredd --version works for you when the installation is done, feel free to ignore the errors.
npm install -g dredd --no-optional to skip the compilation step (learn more about this).
Why Is the Installation So Slow?¶
The installation process features compilation of some C++ components, which may take some time (learn more about this). You can simplify and speed up the process using
npm install -g dredd --no-optional if you are:
- using Dredd exclusively with Swagger,
- using Dredd with small API Blueprint files,
- using Dredd on Windows or other environments with complicated C++11 compiler setup.
--no-optional option avoids any compilation attempts when installing Dredd, but causes slower reading of the API Blueprint files, especially the large ones.