19

I'm on GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.0), but when I try to use package (melpa) to install js2-refactor I get this odd error:

package-compute-transaction: Package `emacs-24.1' is unavailable

Any ideas what this could be about? Actually, this might be coming from a dependency of js2-refactor: js2-mode. It gives the same error.

user2054900
  • 341
  • 3
  • 9
  • 4
    Could it be the case that you have installed `package.el` for pre-24 Emacs versions? If you're using the built-in version, `M-x locate-library RET package` should show a path ending with `lisp/emacs-lisp/package.elc`. If not, getting rid of the file indicated could help. – legoscia Apr 24 '13 at 10:20
  • @legoscia: That did it! I had an old version (from 2007 ver. 0.9) running in an old modes directory. Clearing it and restarting solved it. Thanks. – user2054900 Apr 24 '13 at 13:17
  • @legoscia your advice solved my problem as well. Could you perhaps add it as an answer so it can be accepted+get a vote? – Steen Apr 25 '13 at 08:19

2 Answers2

35

The reason for this can be a lingering old version of package.el in your load path. package.el was officially included in GNU Emacs 24, and the downloadable file for earlier Emacs versions doesn't support dependencies on built-in packages (emacs-24.1 is considered a built-in package here).

Type M-x locate-library RET package to find where Emacs is getting its package.el from. The path it shows should end with lisp/emacs-lisp/package.elc. If it doesn't, try getting rid of the indicated file (or changing the load path so Emacs doesn't find it).

legoscia
  • 39,593
  • 22
  • 116
  • 167
  • Can then the faulty package.el be unloaded or do you have to restart Emacs ? – Arnaud Meuret Jul 07 '16 at 12:24
  • Not sure. Loading the right file with `M-x load-file` might be enough, but there is only one way to find out. (Perhaps the old version set a variable to a value that won't work with the new one, etc.) – legoscia Jul 07 '16 at 12:30
2

I solved a similar issue by uninstalling and reinstalling emacs (macOS/homewbrew).

wprl
  • 24,489
  • 11
  • 55
  • 70