我有一个Angular 项目,我试图转换成一个移动的应用程序usinc离子Angular ,我取代了src文件夹从离子与一个从我的Angular 项目。
使用以下命令时:离子服务器,我得到以下错误:
ionic serve
> ng run app:serve --host=localhost --port=8100
[ng] Error: Unknown arguments: host, port
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
我尝试将angular.json中的项目配置重命名为“app”,而不是包含我的文件的文件夹的名称,但这会导致下面的错误:
ionic serve
> ng run app:serve --host=localhost --port=8100
[ng] An unhandled exception occurred: Invalid target: {"project":"base","target":"build"}.
[ng] See "/private/var/folders/mk/p7qr28c12pv_j8bmq4xxt__80000gn/T/ng-wxz3VS/angular-errors.log" for further details.
[ERROR] ng has unexpectedly closed (exit code 127).
The Ionic CLI will exit. Please check any output above for error details.
其中base是文件夹的名称
在angular.json中,这是我的配置:
"projects": {
"base": {
"root": "src",
"sourceRoot": "src/base",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"hammerjs",
"rxjs",
"lodash",
"file-saver",
"socket.io-client",
"ng-drag-drop",
"z-schema",
"jexl"
],
"outputPath": "dist",
"index": "src/base/index.html",
"main": "src/base/main.ts",
"tsConfig": "src/base/../tsconfig.app.json",
"polyfills": "src/base/../polyfills.ts",
"assets": [
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
},
{
"glob": "**/*",
"input": "src/base/assets",
"output": "/assets"
}
],
"styles": [
"src/base/assets/styles/styles.scss"
],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/base/../environments/environment.ts",
"with": "src/base/../environments/environment.prod.ts"
}
]
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "base:build"
},
"configurations": {
"production": {
"browserTarget": "base:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "base:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/base/../test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/base/../polyfills.ts",
"tsConfig": "src/base/../tsconfig.spec.json",
"scripts": [],
"styles": [
"src/base/assets/styles/styles.scss"
],
"assets": [
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
},
{
"glob": "**/*",
"input": "src/base/assets",
"output": "/assets"
}
]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
我在src中的目录层次结构是File hierarchy
1条答案
按热度按时间j13ufse21#
Ionic提供了相关文档:https://ionicframework.com/docs/intro/cdn#:~:text=对于%20将%20离子%20添加到%20Angular %20CLI的%20ng %20添加%20功能。&text=此%20命令将%20添加%20必要的%20样式,就像添加%20所需的%20样式一样。