我一直在收到类似的错误,下面带有红色下划线
import { ViewChild, ViewContainerRef } from '@angular/core';
import { Component, OnInit } from '@angular/core';
Cannot find module '@angular/core'.
Cannot find module 'rxjs'。。。
但是,并非在所有文件中都发生这种情况,例如在50%的文件中会出现错误,但其他50%都可以。我同时删除了两个node_modules文件夹和package-lock.json文件,并在删除它们后运行“ npm install”。但是我仍然遇到所有这些错误。
下面是我的package.json
{
"name": "app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.2.2",
"@angular/common": "^8.2.2",
"@angular/compiler": "^8.2.2",
"@angular/core": "^8.2.2",
"@angular/forms": "^8.2.2",
"@angular/platform-browser": "^8.2.2",
"@angular/platform-browser-dynamic": "^8.2.2",
"@angular/router": "^8.2.2",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"@progress/kendo-angular-buttons": "^5.0.1",
"@progress/kendo-angular-common": "^1.1.4",
"@progress/kendo-angular-dialog": "^4.1.0",
"@progress/kendo-angular-editor": "^0.10.2",
"@progress/kendo-angular-grid": "^4.4.0",
"@progress/kendo-angular-l10n": "^2.0.0",
"@progress/kendo-angular-label": "^2.0.2",
"@progress/kendo-angular-layout": "^4.1.5",
"@progress/kendo-data-query": "^1.5.2",
"@progress/kendo-drawing": "^1.6.0",
"@progress/kendo-theme-bootstrap": "^4.3.5",
"bootstrap": "^4.3.1",
"classlist.js": "^1.1.20150312",
"core-js": "^2.6.5",
"crypto-js": "^3.1.9-1",
"jquery": "^1.9.1",
"ng5-slider": "^1.1.13",
"ngx-filter-pipe": "^2.1.2",
"ngx-multi-window": "^0.3.2",
"package.json": "^2.0.1",
"popper.js": "^1.14.7",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.4.0",
"rxjs-tslint": "^0.1.7",
"stacktrace-js": "^2.0.0",
"tslib": "^1.9.3",
"web-animations-js": "^2.3.2",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.802.2",
"@angular/cli": "^8.2.2",
"@angular/compiler-cli": "8.2.2",
"@angular/language-service": "8.2.2",
"@types/core-js": "^2.5.0",
"@types/jasmine": "^3.3.9",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^11.9.4",
"codelyzer": "^5.0.1",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "^5.4.2",
"ts-node": "^8.0.2",
"tslint": "^5.12.1",
"typescript": "3.5.3"
}
}