无法构建IONIC iOS - 生成错误

时间:2017-12-30 10:10:55

标签: cordova ionic2

我能够构建一个离子应用程序。当我尝试为iOS构建生产版本时:

ionic cordova build ios --prod

显示以下错误:

  

错误:./ src / app / main.ts       找不到模块:错误:无法解析' ./ app.module.ngfactory' in' / Users / karthikcp / Documents / IONIC / CIS / src / app'       解决' ./ app.module.ngfactory' in' / Users / karthikcp / Documents / IONIC / CIS / src / app'         使用描述文件:/Users/karthikcp/Documents/IONIC/CIS/package.json(相对路径:./ src / app)           Field'浏览器'不包含有效的别名配置         使用描述文件后:/Users/karthikcp/Documents/IONIC/CIS/package.json(相对路径:./ src / app)           使用描述文件:/Users/karthikcp/Documents/IONIC/CIS/package.json(相对路径:./ src / app / app.module.ngfactory)             没有延期               Field'浏览器'不包含有效的别名配置               /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory不存在             .TS               Field'浏览器'不包含有效的别名配置               /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.ts不存在             .js文件               Field'浏览器'不包含有效的别名配置               /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.js不存在             以.json               Field'浏览器'不包含有效的别名配置               /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.json不存在             作为目录               /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory不存在       [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory]       [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.ts]       [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.js]       [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.json]       [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory]        @ ./src/app/main.ts 2:0-60           在BuildError.Error(本机)           在新的BuildError(/Users/karthikcp/Documents/IONIC/CIS/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)           在回调(/Users/karthikcp/Documents/IONIC/CIS/node_modules/@ionic/app-scripts/dist/webpack.js:121:28)           在emitRecords.err(/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:265:13)           在Compiler.emitRecords(/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:371:38)           在emitAssets.err(/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:258:10)           at applyPluginsAsyncSeries1.err(/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:364:12)           在下一个(/Users/karthikcp/Documents/IONIC/CIS/node_modules/tapable/lib/Tapable.js:218:11)           在Compiler.compiler.plugin(/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)           在Compiler.applyPluginsAsyncSeries1(/Users/karthikcp/Documents/IONIC/CIS/node_modules/tapable/lib/Tapable.js:222:13)

我正在使用最新的Ionic版本当不使用--prod时,我能够构建它..请帮助我..我是IONIC的新手

1 个答案:

答案 0 :(得分:1)

我通过删除 <p> <button class="btn btn-light” type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> <img class="d-block w-100 img-responsive" src="https://dummyimage.com/100x100/000/fff" alt="First slide"> </button> </p> <div class="card-body container center"> <button class="btn btn-light none” type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> <h4 class="card-title">SERIES TITLE</h4> </button> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> </div> <div class="collapse" id="collapseExample"> <div class="row container" style="width: 80%; margin: 0 auto;"> <div class="col"> <!-- Button trigger modal --> <a data-toggle="modal" href="#myModal1" class="btn btn-primary btn-lg"> <img class="card-img-top thumb" src="https://dummyimage.com/200x200/000/fff"> </a> <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> <img class="img-fluid" src="https://dummyimage.com/600x400/000/fff"> </div> <div class="modal-footer">Modal Footer Content <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </div> </div> </div> 解决了这个问题。使用以下命令更新了package.json:

node_modules,package-lock.json

并重新开始

  

npm install