question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Find Phoenix.Router, others in new Phoenix project.

See original GitHub issue

In Phoenix projects, use Phoneix.X gives a lint warning saying that it cannot find the proper module.

Steps to reproduce:

  1. Download Phoenix has per their instructions.
  2. mix phoenix.new Test /path/to/test
  3. cd /path/to/test
  4. mix deps.get
  5. mix compile
  6. subl /path/to/test/web/router.ex

See a red dot on line 2 with statement "Error: module Phoenix.Router is not loaded and cannot be found.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
andrefcommented, Jan 23, 2015

I had the same issue and discovered that the linter plugin cannot find the mix project. When elixirc runs, it doesn’t have a proper path where to find the modules.

That happens because find_mix_project uses os.getcwd if no argument is given as a starting point. However, there’s no guarantee that the current directory will be the phoenix project (in my case, it was the Sublime Text package folder or some such). I fixed it by changing elixir_sublime.py and feeding find_mix_project the file the linter is currently handling, self.filename:

  class ElixirLinter(Linter):
      ...
      def cmd(self):
          ...
          for path in find_ebin_folders(find_mix_project(self.filename)):
              command.extend(['-pa', path])

I’m not sure if this will break other stuff since I never wrote a sublime linter plugin (and that’s why I’m not making a PR), but it works for me.

1reaction
hiphooxcommented, Jan 9, 2015

yeah, I have the same problem with all my use statements.

Example: use Ecto.Repo, adapter: Ecto.Adapters.Postgres

I’m using Yosemite and I opened sublime in the project directory repo_ex_ peopleware_and_cannot_find_phoenix_router__others_in_new_phoenix_project_ issue__5 _vishnevskiy_elixirsublime

Read more comments on GitHub >

github_iconTop Results From Across the Web

Routing — Phoenix v1.6.15 - HexDocs
Phoenix provides an excellent tool for investigating routes in an application: ... The router supports other macros besides those for HTTP verbs like...
Read more >
Phoenix.Router.NoRouteError for assets - Stack Overflow
in apps directory try to install phoenix project with this command mix phx.new phx_project --no-ecto. and trye to add assets with new ......
Read more >
Creating a new Phoenix project | Phoenix Web Development
To get started on a project and generate the Phoenix application skeleton we'll need to start developing, we'll run a special command using...
Read more >
Cannot load assets in Phoenix umbrella app - Elixir Forum
To do this I decided to add a phoenix project under the umbrella using: ... GET /assets/app.css 16:17:44.887 [debug] ** (Phoenix.Router.
Read more >
Phoenix 1.7-rc released: Built-in Tailwind, Verified Routes ...
router get "/oauth/callbacks/:id", OAuthCallbackController, :new ... your router, and let you know when it can't find a matching route:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found