Skip to content
Zen00 edited this page Nov 2, 2015 · 7 revisions

Error Messages

Unable to expose method "...". It is already implemented by Request.

A request call like rp('http://google.com') or rp.post('form.php') returns an object that is identical to what Request (the library) would return plus some methods exposed from the Bluebird promise. If you got this error Request-Promise took the Bluebird method with the name mentioned in the error message and tried to attach it to the request call object. However, Request already implements a method with this name.

This name conflict is most likely introduced by a new version of Request which now implements the mentioned method. Until an update of Request-Promise is released you have two options to circumvent this issue:

  1. Search your code for any use of the mentioned method and make the following changes. These changes will fix the issue properly so you won't need to revert them back once a new version of Request-Promise is released.
// Let us say you got the error:
// Unable to expose method "catch". It is already implemented by Request.

rp('http://google.com').catch(...);
// ... needs to be changed to:
rp('http://google.com').promise().catch(...);

// However,
rp('http://google.com').then(...).catch(...);
// ... can remain unchanged since "catch" is only used further down the chain.

// Please also change any occurrences where http shortcut methods are used:
rp.post('form.php').catch(...);
// ... needs to be changed to:
rp.post('form.php').promise().catch(...);
  1. If you need to change your code according to option 1 but don't want to invest your time right now, you may install an earlier version of Request and wait for the release notes of the next version of Request-Promise. They may recommend a more viable solution.

npm ERR! Error: failed to fetch from registry:

If you have this error, odds are your versions are out of date and you're not on the right repository to update them.

I had this issue with npm v1.1.4 (and node v0.6.12), which are the Ubuntu 12.04 repository versions.

It looks like that version of npm isn't supported any more, updating node (and npm with it) resolved the issue.

First, uninstall the outdated version (optional, but I think this fixed an issue I was having with global modules not being pathed in).

sudo apt-get purge nodejs npm Then enable nodesource's repo and install:

curl -sL https://deb.nodesource.com/setup | sudo bash - sudo apt-get install -y nodejs

*Sourced from: http://stackoverflow.com/questions/12913141/message-failed-to-fetch-from-registry-while-trying-to-install-any-module