'can't install doom-modeline package on emacs

I'm new at emacs. I'm trying to install doom-modeline using this command

M-x package-install RET doom-modeline RET

but it seems to not be in the package list

My init.el looks like this:

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives 
                   '(("melpa" ."https://melpa.org/packages/")
                     ("elpa" . "https://elpa.gnu.org/packages/")
                     ("org" . "https://orgmode.org/elpa/")))

(unless package--initialized 
    (package-initialize))

(unless package-archive-contents
    (package-refresh-contents))

;; Initialize use-package on non-Linux platforms
(unless (package-installed-p 'use-package)
    (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure t)

;; Setup use-package
(unless (package-installed-p 'use-package)
    (package-refresh-contents)
    (package-install 'use-package))
(eval-when-compile
    (require 'use-package))
(setq use-package-always-ensure t)

What can I do?



Solution 1:[1]

I suspect you just need to do this:

M-x package-refresh-contents RET

And then try installing it again.

Failing that, check that you don't already have it installed, as package-install doesn't offer to install the things you already have.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 phils