Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

angular - Ionic, error when generating production build

I'm stuck with an error that I cannot solve.

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:

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' 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' 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:UserscemanDesktopidem-app-updated-master [email protected]:237:55 at step (C:UserscemanDesktopidem-app-updated-master [email protected]:32:23) at Object.next (C:UserscemanDesktopidem-app-updated-master [email protected]:13:53) at fulfilled (C:UserscemanDesktopidem-app-updated-master [email protected]: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

This is my configuration according to ionic info:

Ionic:

ionic (Ionic CLI)  : 4.0.0-rc.9 (C:UserscemanAppDataRoaming
pm
ode_modulesionic)
Ionic Framework    : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.10

Cordova:

cordova (Cordova CLI) : not installed
Cordova Platforms     : android 7.1.0

System:

Android SDK Tools : 26.1.1
NodeJS            : v6.14.3 (P:
odejs
ode.exe)
npm               : 6.1.0
OS                : Windows 10

Environment:

ANDROID_HOME : P:Androidsdk

I add an extra data, I had updated to Node 8 to see if this corrected something and nothing, I returned to version 6.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need to import IonicModule in your module.ts & then use it like this:

import { IonicModule } from 'ionic-angular';

...

@NgModule({
    imports: [
        IonicModule.forRoot(yourPage)
    ],

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...