1

I am trying to install the projectile library. I am using Emacs 24.4.1, and I installed projectile-20150405.126 from the Emacs package manager. Then I tried to activate it in my init file:

(require 'projectile)
(projectile-global-mode)

But this gives an error when I am starting Emacs:

  • Warning (initialization): An error occurred while loading `/home/hakon/.emacs': File error: Cannot open load file, no such file or directory, projectile

I tried to debug using emacs -Q and it seems like I am missing a package called dash..

According to the installation instructions at http://batsov.com/projectile/ I should not need to install dash first when using the package manager..

Håkon Hægland
  • 3,608
  • 1
  • 20
  • 51

1 Answers1

2

By default Emacs initializes packages after loading your init file, for historic and obscure reasons. Hence packages are normally not available in your init file.

You need explicitly initialize the package manager first with (package-initialize). This adds all packages to load-path, thus fixing this specific error. Alternatively, you can delay Projectile setup until after init.el was loaded, by using (add-hook 'after-init-hook #'projectile-global-mode) instead.

  • Thanks, I think I was confused when the manual said `You can enable Projectile globally like this (projectile-global-mode)`.. I thought this meant I should put that line in the init file.. Maybe it should instead say: `You can enable Projectile globally like this (add-hook 'after-init-hook #'projectile-global-mode)` ? – Håkon Hægland Apr 09 '15 at 13:16