我尝试了这些命令
npm install --save-dev @angular/forms@latest,
npm install --save @angular/cdk,
npm install,
npm i @angular/core
但是这些都没有帮助,我得到了这个错误。是否有导入这些模块的方法?
是否缺少要导入的模块?
我的Angular版本是最新版本。
PS C:\Users\Desktop\Projects\AngularATM\ATM-Project> ng serve -o --port 2406
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:2406/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.htmlchunk {main} main.js, main.js.map (main) 2.05 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 122 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 163 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.15 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 338 kB [initial] [rendered]
Date: 2019-07-15T08:56:03.101Z - Hash: deffe6e2b4df5ec54097 - Time: 4838ms
ERROR in ../node_modules/@agm/core/core.module.d.ts:1:37 - error TS2307: Cannot find module '@angular/core'.
1 import { ModuleWithProviders } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/circle.d.ts:1:74 - error TS2307: Cannot find module '@angular/core'.
1 import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChange } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/data-layer.d.ts:1:75 - error TS2307: Cannot find module '@angular/core'.
1 import { EventEmitter, OnDestroy, OnInit, OnChanges, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/fit-bounds.d.ts:1:61 - error TS2307: Cannot find module '@angular/core'.
1 import { OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/info-window.d.ts:1:86 - error TS2307: Cannot find module '@angular/core'.
1 import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChange } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/kml-layer.d.ts:1:75 - error TS2307: Cannot find module '@angular/core'.
1 import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/map.d.ts:1:95 - error TS2307: Cannot find module '@angular/core'.
1 import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/marker.d.ts:1:95 - error TS2307: Cannot find module '@angular/core'.
1 import { AfterContentInit, EventEmitter, OnChanges, OnDestroy, QueryList, SimpleChange } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/marker.d.ts:2:43 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable, ReplaySubject } from 'rxjs';
~~~~~~
../node_modules/@agm/core/directives/polygon.d.ts:1:85 - error TS2307: Cannot find module '@angular/core'.
1 import { AfterContentInit, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/polyline-icon.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { OnInit } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/polyline-point.d.ts:1:56 - error TS2307: Cannot find module '@angular/core'.
1 import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/polyline.d.ts:1:96 - error TS2307: Cannot find module '@angular/core'.
1 import { AfterContentInit, EventEmitter, OnChanges, OnDestroy, QueryList, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/rectangle.d.ts:1:74 - error TS2307: Cannot find module '@angular/core'.
1 import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChange } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/directives/transit-layer.d.ts:1:61 - error TS2307: Cannot find module '@angular/core'.
1 import { OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/fit-bounds.d.ts:1:45 - error TS2307: Cannot find module 'rxjs'.
1 import { BehaviorSubject, Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/google-maps-api-wrapper.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/google-maps-api-wrapper.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/circle-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/circle-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/data-layer-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/data-layer-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/info-window-manager.d.ts:1:28 - error TS2307: Cannot find module 'rxjs'.
1 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/info-window-manager.d.ts:2:24 - error TS2307: Cannot find module '@angular/core'.
2 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/kml-layer-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/kml-layer-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/marker-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/marker-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/polygon-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/polygon-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/polyline-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/polyline-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/managers/rectangle-manager.d.ts:1:24 - error TS2307: Cannot find module '@angular/core'.
1 import { NgZone } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/services/managers/rectangle-manager.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
~~~~~~
../node_modules/@agm/core/services/maps-api-loader/lazy-maps-api-loader.d.ts:1:32 - error TS2307: Cannot find module '@angular/core'.
1 import { InjectionToken } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/utils/browser-globals.d.ts:1:26 - error TS2307: Cannot find module '@angular/core'.
1 import { Provider } from '@angular/core';
~~~~~~~~~~~~~~~
../node_modules/@agm/core/utils/mvcarray-utils.d.ts:2:28 - error TS2307: Cannot find module 'rxjs'.
2 import { Observable } from 'rxjs';
由于我已经尝试了上面的所有命令,因此如何解决这些错误?
答案 0 :(得分:0)
删除节点模块和package-lock.json并执行“ npm install”。之后,安装单个模块,例如“ npm install moduleName --save”