I want to automatically install packages that I don't have locally installed when I initialize Emacs. I use the following code to install some packages.
(package-initialize) (mapc #'(lambda (pkg) (if (not (package-installed-p pkg)) (package-install pkg))) (list 'json-mode ; ...
However, when loading Emacs, Emacs says the package is not available for installation. However, it exists on the packages buffer.
error: Package `json-mode' is not available for installation
Does anyone know what I am doing wrong?