离子,生成生产版本时出错 [英] Ionic, error when generating production build
问题描述
我陷入了无法解决的错误之中.
I'm stuck with an error that I cannot solve.
尝试使用-prod 创建内部版本时出现错误,我正在修复,更新依赖关系,并且当前在执行ionic cordova build android --prod --verbose
时得到:
The error started when trying to create the build with --prod, I was fixing, updating dependencies and currently when executing ionic cordova build android --prod --verbose
I get:
打字稿错误 "ion-icon"不是已知元素:1.如果"ion-icon"是Angular组件,则请验证它是否是Angular组件的一部分. 这个模块. 2.如果'ion-icon'是Web组件,则将'CUSTOM_ELEMENTS_SCHEMA'添加到 该组件的"@ NgModule.schemas"以禁止显示此消息. (> [错误->] )
typescript error 'ion-icon' is not a known element: 1. If 'ion-icon' is an Angular component, then verify that it is part of this module. 2. If 'ion-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("> [ERROR ->] ")
'ion-buttons'不是一个已知元素:1.如果'ion-buttons'是Angular组件,则验证它是否是 此模块的一部分. 2.如果"ion-buttons"是Web组件,则将"CUSTOM_ELEMENTS_SCHEMA"添加到 该组件的"@ NgModule.schemas"以禁止显示此消息. ("[ERROR->]")
'ion-buttons' is not a known element: 1. If 'ion-buttons' is an Angular component, then verify that it is part of this module. 2. If 'ion-buttons' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" [ERROR ->] ")
'ion-col'不是一个已知元素:1.如果'ion-col'是Angular组件,则验证它是否属于Angular组件. 这个模块. 2.如果"ion-col"是Web组件,则将"CUSTOM_ELEMENTS_SCHEMA"添加到"@ NgModule.schemas" 取消显示此消息. (" [错误 ->]
错误:Angular AoT构建失败.看到上面的问题 错误:Angular AoT构建失败.看到上面的问题 在C:\ Users \ ceman \ Desktop \ idem-app-updated-master \ node_modules \ @ionic \ app-scripts \ dist \ aot \ aot-compiler.js:237:55 在步骤(C:\ Users \ ceman \ Desktop \ idem-app-updated-master \ node_modules \ @ionic \ app-scripts \ dist \ aot \ aot-compiler.js:32:23) 在Object.next(C:\ Users \ ceman \ Desktop \ idem-app-updated-master \ node_modules \ @ionic \ app-scripts \ dist \ aot \ aot-compiler.js:13:53) 完成时(C:\ Users \ ceman \ Desktop \ idem-app-updated-master \ node_modules \ @ionic \ app-scripts \ dist \ aot \ aot-compiler.js:4:58) [错误]找不到命令:ionic-app-scripts ionic:cli-framework:utils:process onBeforeExit处理程序:process.exit接收到+ 0ms ionic:cli-framework:utils:process onBeforeExit处理程序:运行1个排队的函数+ 0ms ionic:cli-framework:utils:process onBeforeExit处理程序:退出(退出代码127)+ 0ms
'ion-col' is not a known element: 1. If 'ion-col' is an Angular component, then verify that it is part of this module. 2. If 'ion-col' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" [ERROR ->]
Error: The Angular AoT build failed. See the issues above Error: The Angular AoT build failed. See the issues above at C:\Users\ceman\Desktop\idem-app-updated-master\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:237:55 at step (C:\Users\ceman\Desktop\idem-app-updated-master\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23) at Object.next (C:\Users\ceman\Desktop\idem-app-updated-master\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53) at fulfilled (C:\Users\ceman\Desktop\idem-app-updated-master\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58) [ERROR] Command not found: ionic-app-scripts ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms ionic:cli-framework:utils:process onBeforeExit handler: running 1 queued functions +0ms ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 127) +0ms
这些是我的文件,请告诉我是否需要查看其他文件:
These are my files, tell me if you need to see another:
app.module.ts:: https://pastebin.com/TXQ4tDFM
package.json: https://pastebin.com/kAK5eK5Z
这是我根据ionic info
进行的配置:
This is my configuration according to ionic info
:
离子:
ionic (Ionic CLI) : 4.0.0-rc.9 (C:\Users\ceman\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.10
科尔多瓦:
cordova (Cordova CLI) : not installed
Cordova Platforms : android 7.1.0
系统:
Android SDK Tools : 26.1.1
NodeJS : v6.14.3 (P:\nodejs\node.exe)
npm : 6.1.0
OS : Windows 10
环境:
ANDROID_HOME : P:\Android\sdk
我添加了额外的数据,我已经更新到节点8,以查看它是否可以纠正某些问题,我返回了版本6.
I add an extra data, I had updated to Node 8 to see if this corrected something and nothing, I returned to version 6.
推荐答案
您需要在module.ts
&中导入IonicModule
.然后像这样使用它:
You need to import IonicModule
in your module.ts
& then use it like this:
import { IonicModule } from 'ionic-angular';
...
@NgModule({
imports: [
IonicModule.forRoot(yourPage)
],
这篇关于离子,生成生产版本时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!