Я уже видел этот вопрос раньше.
Я использую NativeScript с Angular и пытаюсь собрать и запустить на устройстве Android.
Предлагаемое исправление, которое мне не помогло, - убедиться, что angular -cli версия не должна быть больше angular версии. Я изменил номера версий в моем пакете. json и удалил node_modules и package-lock. json и запустил npm i
tns run android
:
Error: Cannot find module '@angular/compiler-cli/ngcc'
Require stack:
- C:\PathTo\MyApp\node_modules\@ngtools\webpack\src\ngcc_processor.js
- C:\PathTo\MyApp\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js
- C:\PathTo\MyApp\node_modules\@ngtools\webpack\src\index.js
- C:\PathTo\MyApp\node_modules\nativescript-dev-webpack\plugins\NativeScriptAngularCompilerPlugin.js
- C:\PathTo\MyApp\webpack.config.js
- C:\PathTo\MyApp\node_modules\webpack-cli\bin\convert-argv.js
- C:\PathTo\MyApp\node_modules\webpack-cli\bin\cli.js
- C:\PathTo\MyApp\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\PathTo\MyApp\node_modules\@ngtools\webpack\src\ngcc_processor.js:10:16)
at Module._compile (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\PathTo\MyApp\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:23:26)
at Module._compile (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\PathTo\MyApp\node_modules\@ngtools\webpack\src\index.js:13:10)
at Module._compile (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\PathTo\MyApp\node_modules\nativescript-dev-webpack\plugins\NativeScriptAngularCompilerPlugin.js:4:19)
at Module._compile (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\PathTo\MyApp\webpack.config.js:16:38)
at Module._compile (C:\PathTo\MyApp\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\PathTo\\MyApp\\node_modules\\@ngtools\\webpack\\src\\ngcc_processor.js',
'C:\\PathTo\\MyApp\\node_modules\\@ngtools\\webpack\\src\\angular_compiler_plugin.js',
'C:\\PathTo\\MyApp\\node_modules\\@ngtools\\webpack\\src\\index.js',
'C:\\PathTo\\MyApp\\node_modules\\nativescript-dev-webpack\\plugins\\NativeScriptAngularCompilerPlugin.js',
'C:\\PathTo\\MyApp\\webpack.config.js',
'C:\\PathTo\\MyApp\\node_modules\\webpack-cli\\bin\\convert-argv.js',
'C:\\PathTo\\MyApp\\node_modules\\webpack-cli\\bin\\cli.js',
'C:\\PathTo\\MyApp\\node_modules\\webpack\\bin\\webpack.js'
]
}
Executing webpack failed with exit code 1.
Вот мой пакет. json:
{
"description": "MyApp",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "com.MyApp.app",
"tns-android": {
"version": "6.2.0"
},
"tns-ios": {
"version": "6.2.0"
}
},
"scripts": {
"lint": "tslint \"app/**/*.ts\""
},
"dependencies": {
"@angular/animations": "^7.0.1",
"@angular/common": "^7.0.1",
"@angular/compiler": "^7.0.1",
"@angular/core": "^7.0.1",
"@angular/forms": "^7.0.1",
"@angular/http": "~6.0.0",
"@angular/platform-browser": "^7.0.1",
"@angular/platform-browser-dynamic": "^7.0.1",
"@angular/router": "^7.0.1",
"@nativescript/theme": "^2.2.1",
"nativescript-angular": "^8.20.4",
"nativescript-camera": "^4.0.2",
"nativescript-drop-down": "^4.0.1",
"nativescript-imagepicker": "^6.0.4",
"nativescript-modal-datetimepicker": "^1.1.4",
"nativescript-theme-core": "~1.0.4",
"nativescript-toast": "^2.0.0",
"nativescript-ui-listview": "7.0.0",
"reflect-metadata": "~0.1.10",
"rxjs": "^6.5.4",
"tns-core-modules": "^6.3.2",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular/cli": "7.0.1",
"@angular/compiler-cli": "7.0.1",
"@ngtools/webpack": "^8.3.25",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"codelyzer": "~4.5.0",
"extract-text-webpack-plugin": "~3.0.2",
"lazy": "1.0.11",
"nativescript-dev-webpack": "^1.4.1",
"node-sass": "^4.13.1",
"tslint": "~5.12.1",
"typescript": "^3.4.5",
"uglifyjs-webpack-plugin": "~2.1.1",
"webpack": "^4.41.5"
}
}
Вот выход из ng --version
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.0.1
Node: 12.13.1
OS: win32 x64
Angular: 7.2.16
... animations, common, compiler, core, forms, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.10.1
@angular-devkit/core 7.0.1
@angular-devkit/schematics 7.0.1
@angular/cli 7.0.1
@angular/compiler-cli 7.0.1
@angular/http 6.0.9
@ngtools/webpack 8.3.25
@schematics/angular 7.0.1
@schematics/update 0.10.1
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.5 4.41.5
Я на NativeScript 6.2.2.
Есть идеи? ТИА.