Why can't my emacs find the google-translate package from melpa ? I have trried

(use-package google-translate :ensure t)

And it doesn't find it, also M-x install-package does provide a google-translate entry with tab completion, but it still doesn't find the package.

  • What's the result of M-x package-install google-translate exactly? Maybe your package archives is outdated, if so, try M-x package-refresh-contents first. – xuchunyang Jan 14 '16 at 13:26
  • Oh thanks it was just that ! I thought package list was refreshed after each start but thanks not. – Nicolas Scotto Di Perto Jan 14 '16 at 13:31
  • @Nicolas That's correct. The refresh is automatic whenever you do a fresh M-x package-list-packages. You should not need to do the refresh manually. – Kaushal Modi Jan 14 '16 at 14:39
  • @Nicolas Or looks like that you never list the packages and usually just do M-x package-install. – Kaushal Modi Jan 14 '16 at 14:41
  • 2
    @xuchunyang Can you write your comment as an answer so that this question can be marked as answered? – Kaushal Modi Jan 14 '16 at 16:37

This happens to me as well from time to time, the cause is melpa keeps only latest version of packages, so it is safe to always update package archive with M-x package-refresh-contents or M-x list-packages before installing package from melpa, of course, this is time-consuming and inconvenient.

Here is a rough programmatic solution that I can think of at this moment, I guess both M-x package-install some-package and (use-package some-package :ensure t) should work even when some-package's archive is outdated.

(defun package-install-ensure-melpa (orig-fun &rest args)
  (condition-case nil
      (apply orig-fun args)
     (progn (package-refresh-contents)
            (apply orig-fun args)))))

(advice-add 'package-install :around #'package-install-ensure-melpa)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.