当我用angular-cli创建一个新的angular项目时,通过npm install @uirouter/angular
安装UIRotuer包并将模块导入app.module.ts
import数组中之后,出现了在照片中显示的错误。
ERROR in node_modules/@uirouter/angular/directives/uiSref.d.ts:3:63 - error TS2307: Cannot find module '@uirouter/core'.
3 import { UIRouter, Obj, TransitionOptions, TargetState } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/directives/uiSrefStatus.d.ts:5:46 - error TS2307: Cannot find module '@uirouter/core'.
5 import { TargetState, UIRouterGlobals } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/directives/uiView.d.ts:4:69 - error TS2307: Cannot find module '@uirouter/core'.
4 import { StateDeclaration, UIRouter, ViewConfig, ViewContext } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/index.d.ts:10:15 - error TS2307: Cannot find module '@uirouter/core'.
10 export * from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/interface.d.ts:3:76 - error TS2307: Cannot find module '@uirouter/core'.
3 import { StateDeclaration, _ViewDeclaration, Transition, HookResult } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/lazyLoad/lazyLoadNgModule.d.ts:4:62 - error TS2307: Cannot find module '@uirouter/core'.
4 import { Transition, LazyLoadResult, StateDeclaration } from '@uirouter/core';
~~~~~~~~~~~~~~~~m
node_modules/@uirouter/angular/providers.d.ts:89:129 - error TS2307: Cannot find module '@uirouter/core'.
89 import { UIRouter, StateRegistry, StateService, TransitionService, UrlMatcherFactory, UrlRouter, ViewService, UrlService } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/statebuilders/lazyLoad.d.ts:3:62 - error TS2307: Cannot find module '@uirouter/core'.
3 import { LazyLoadResult, Transition, StateDeclaration } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/statebuilders/lazyLoad.d.ts:4:46 - error TS2307: Cannot find module '@uirouter/core'.
4 import { BuilderFunction, StateObject } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/statebuilders/views.d.ts:2:29 - error TS2307: Cannot find module '@uirouter/core'.
2 import { StateObject } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/statebuilders/views.d.ts:3:26 - error TS2307: Cannot find module '@uirouter/core'.
3 import { PathNode } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/statebuilders/views.d.ts:4:28 - error TS2307: Cannot find module '@uirouter/core'.
4 import { ViewConfig } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/uiRouterConfig.d.ts:2:39 - error TS2307: Cannot find module '@uirouter/core'.
2 import { UIRouter, StateObject } from '@uirouter/core';
~~~~~~~~~~~~~~~~
node_modules/@uirouter/angular/uiRouterNgModule.d.ts:6:92 - error TS2307: Cannot find module '@uirouter/core'.
6 import { UrlRuleHandlerFn, TargetState, TargetStateDef, UIRouter, TransitionService } from '@uirouter/core';
~~~~~~~~~~~~~~~~
** Angular Live Development Server is listening on localhost:4300, open your browser on http://localhost:4300/ **
ℹ 「wdm」: Failed to compile.
我想问题出在ui-router上,因为直到我完善模块之前,控制台都没有给出错误。 我试图重新安装依赖项,但是它仍然给我一个问题,直到几天前才出现。
答案 0 :(得分:0)
我遇到了同样的问题。安装缺少的软件包可以为我解决。
npm install @uirouter/core
npm install @uirouter/rx