9

I've just created a new folder of javascript files.

The structure is:

.gitignore
README.md
build
node_modules
package.json
src
webpack.config.js

But when I try and find a file with C-c p f, I get a message in the status bar that states

You're not in a project

I have other projects with the same structure that work fine so I don't know what is going on.

mihai
  • 4,592
  • 3
  • 29
  • 42
dagda1
  • 26,856
  • 59
  • 237
  • 450

3 Answers3

15

I think your project is indeed considered a project by projectile only if you have a .git folder in it (did you forget to git init?). I'm not seeing one in your case. You can alternatively add a .projectile file instead. Everything in that folder containing the .projectile file and all subfolders will be considered part of the same project.

mihai
  • 4,592
  • 3
  • 29
  • 42
2

Simply open any file in the git project using C-x C-f and then try running command C-c p f.

Opening a file in a git project will make projectile recognize the project.

Just open some file in a version-controlled (e.g. git) or a project (e.g. maven) directory that's recognized by Projectile and you're ready for action.

Yogeswaran
  • 357
  • 1
  • 13
0

Disclaimer: I know this post is now old but since I encountered a similar issue today, it seems to me relevant to share my notes about it, taking care of users not too familiar with emacs lisp.


The culprit function is likely projectile-project-root.

You can try to investigate about it with

  • C-h f or (describe-function 'projectile-project-root)
  • C-h v or (describe-variable 'projectile-require-project-root)

The help screen provides a link to the elisp source code which you could step through using debug-on-entry (see info node "Debugging" in elisp)

This function uses caching so this might be somewhat uneasy, depending on your skills with emacs lisp.


Workaround:

I solved my case by moving my project to another directory, suspecting that its name starting with "test" may have caused the problem. I also removed project cache subdirs (check hidden as well).

RockyRoad
  • 640
  • 5
  • 17