Angular-cli: Could not resolve route

Created on 18 Dec 2016  路  16Comments  路  Source: angular/angular-cli

angular-cli: 1.0.0-beta.22-1
node: 7.1.0
os: linux x64

i'm new to angular2 and not sure how loadChildren is supposed to work.
I upgraded coreui from angular 2.1.2 to 2.2.3 and it broke here:

Could not resolve route "app/dashboard/dashboard.module#DashboardModule" from file "/home/aep/kram/CoreUI-Free-Bootstrap-Admin- Template/Angular2_CLI_Full_Project/src/app/app.module".

children: [ { path: 'dashboard', loadChildren: 'app/dashboard/dashboard.module#DashboardModule' },

what's the path supposed to be with this relative structure?

src/app/app.module.ts src/app/dashboard/dashboard.module.ts

i tried:

  • app/dashboard/dashboard.module#DashboardModule
  • dashboard/dashboard.module#DashboardModule
  • ../app/dashboard/dashboard.module#DashboardModule
  • ../../dashboard/dashboard.module#DashboardModule
  • src/app/dashboard/dashboard.module#DashboardModule

Most helpful comment

I think somehow angular has changed their path resolver. By changing the path from

app/dir1/dir2/...

(assuming the routes module is configured inside app directory) to
./dir1/dir2/...

Can solve this problem.

All 16 comments

I have the same issue as above

I am not sure that this is CLI related but could you paste in your routes somewhere? (parent and a child route)

I have the same issue as well ....

I think somehow angular has changed their path resolver. By changing the path from

app/dir1/dir2/...

(assuming the routes module is configured inside app directory) to
./dir1/dir2/...

Can solve this problem.

@xwb1989 save the day !!

fixed it for me too. thanks @xwb1989 !

After changing it as @xwb1989 says , it works! THX

@xwb1989 Thanks!

i getting same problem..
how to solve?

Just do it like @xwb1989 says, change the app directory to ./dir1/dir2/...

yes change like this
./requests/requests.module#RequestsModule

but i getting same problem

{
    path:'requests',
    loadChildren:'./requests/requests.module#RequestsModule'
  },

these are my angular versions...
@angular/cli: 1.0.0-rc.2
node: 6.1.0
os: win32 x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/compiler-cli: 2

pls tell me how to solve?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings