如何修复"找不到模块:"@angular/编译器"错误?



我已经升级到最新的nativescript,打字稿并使用angular。现在,每当我尝试编译时,无论我编译到哪个平台,我都会收到此错误。

错误:com.tns.NativeScript异常:找不到模块:"@angular/编译器",相对于:app/tns_modules/

下面是我的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应该在依赖项下,而不是devDependencies下。同样在最新版本中,他们使用@ngtools/webpack而不是实际的webpack包。

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

相关内容

最新更新