Nativescript 我如何修复我的";找不到模块:"@角度/编译器“;错误?

Nativescript 我如何修复我的";找不到模块:"@角度/编译器“;错误?,nativescript,nativescript-angular,Nativescript,Nativescript Angular,我已经升级到最新的nativescript、typescript和angular。现在,无论我编译到哪个平台,每当我尝试编译时,都会出现这个错误 错误:com.tns.NativeScriptException:未能找到模块:“@angular/compiler”,相对于:app/tns_模块/ 下面是我的package.json依赖项: "dependencies": { "@angular/animations": "~6.1.0", "@angular/common

我已经升级到最新的nativescript、typescript和angular。现在,无论我编译到哪个平台,每当我尝试编译时,都会出现这个错误

错误:com.tns.NativeScriptException:未能找到模块:“@angular/compiler”,相对于:app/tns_模块/

下面是我的package.json依赖项:

    "dependencies": {
    "@angular/animations": "~6.1.0",
    "@angular/common": "~6.1.0",
    "@angular/core": "~6.1.0",
    "@angular/forms": "~6.1.0",
    "@angular/http": "~6.1.0",
    "@angular/platform-browser": "~6.1.0",
    "@angular/platform-browser-dynamic": "~6.1.0",
    "@angular/router": "~6.1.0",
    "async-await": "^0.1.40",
    "lodash": "^4.17.10",
    "moment": "^2.22.0",
    "nativescript-angular": "^6.1.0",
    "nativescript-audio": "^5.0.0",
    "nativescript-drop-down": "^4.0.1",
    "nativescript-orientation": "^2.2.0",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-ui-listview": "3.5.9",
    "nativescript-ui-sidedrawer": "^4.1.1",
    "nativescript-unit-test-runner": "^0.3.4",
    "nativescript-videoplayer": "^4.1.0",
    "nativescript-webview-interface": "^1.4.2",
    "nativescript-xmlobjects": "^1.1.4",
    "node-sass": "^4.9.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "^6.0.0",
    "tns-core-modules": "^4.2.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.10.3",
    "@angular/cli": "^7.0.3",
    "@angular/compiler": "^6.1.10",
    "@angular/compiler-cli": "~6.1.0",
    "@types/lodash": "4.14.68",
    "@types/node": "~6.0.60",
    "babel-traverse": "^6.26.0",
    "babel-types": "^6.26.0",
    "babylon": "6.4.5",
    "jasmine-core": "^3.1.0",
    "karma": "^3.1.1",
    "karma-jasmine": "^1.1.1",
    "karma-nativescript-launcher": "^0.4.0",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "^1.6.0",
    "nativescript-dev-typescript": "^0.7.4",
    "nativescript-dev-webpack": "^0.16.3",
    "tns-platform-declarations": "^3.4.1",
    "ts-node": "~3.3.0",
    "tslint": "^5.8.0",
    "typescript": "~2.7.2",
    "webpack": "^4.23.1",
    "webpack-dev-server": "^3.1.10"
  },

@angular/compiler
应该在依赖项下,而不是依赖项下。同样在最新版本中,他们使用
@ngtools/webpack
而不是实际的
webpack


因此,如果您将您的
包.json
与默认模板中的包进行比较,并进行必要的更改,可能会更好。

@angular/compiler
应该在依赖项下,而不是依赖项下。同样在最新版本中,他们使用
@ngtools/webpack
而不是实际的
webpack


因此,如果您将您的
package.json
与默认模板中的包进行比较并进行必要的更改,可能会更好。

您是否尝试了干净的构建?我可以知道您从哪个版本升级到最新版本吗?您是否尝试过干净的版本?我可以知道您从哪个版本升级到了最新版本吗?谢谢,将@angular/编译器移到依赖项中是个窍门。另外,最好看看angular template package.jsonTanks,将@angular/编译器移到依赖项中是一个技巧。另外,建议您查看angular template package.json