Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法读取属性';visitExpression';复制模块后未定义的_Javascript_Angular_Typescript_Angular2 Routing - Fatal编程技术网

Javascript 无法读取属性';visitExpression';复制模块后未定义的

Javascript 无法读取属性';visitExpression';复制模块后未定义的,javascript,angular,typescript,angular2-routing,Javascript,Angular,Typescript,Angular2 Routing,我目前正在使用自定义模块进行Angular2项目,以保持代码干净。在我把这个模块复制到另一个项目之前,一切都很好 自从我将模块复制到另一个项目中后,我遇到以下错误:uncaughttypeerror:无法读取未定义的属性“visitExpression” 经过几个小时的谷歌搜索,我发现了几个可能的原因,我都测试过了(但没有成功): 路由中的双逗号(,) 组件中的空选择器 以下是我尝试过的其他一些事情: 查找模块中的每个导入,确保其正确无误 使用Gulp生成typescript文件(生成成功

我目前正在使用自定义模块进行Angular2项目,以保持代码干净。在我把这个模块复制到另一个项目之前,一切都很好

自从我将模块复制到另一个项目中后,我遇到以下错误:
uncaughttypeerror:无法读取未定义的属性“visitExpression”

经过几个小时的谷歌搜索,我发现了几个可能的原因,我都测试过了(但没有成功):

  • 路由中的双逗号(,)
  • 组件中的空选择器
以下是我尝试过的其他一些事情:

  • 查找模块中的每个导入,确保其正确无误
  • 使用Gulp生成typescript文件(生成成功,无警告/错误)

对于下一步尝试什么,我没有什么线索,有什么建议吗?

路由数组中任何逗号的错位都可能导致这种情况

const authRoutes: Routes = [,        //<--- This was my issue when I faced it
  {path: 'signup', component:  SignupComponent},
  {path: 'signin', component:  SigninComponent},
]

const authrouts:Routes=[,//我得到它是因为逗号放错了位置

 const routes: Routes = [
   { path: 'dashboard', component: DashboardComponent},
   { path: 'login', component: LoginComponent }
 ];

当导入中可能有一个额外的逗号或不同的表达式时,就会发生此错误。

在我的情况下,错误仍然会在禁用所有路由的情况下弹出。导致此错误的路由并不总是这些路由。由于错误是不明确的,因此我无法进行调试。