1.[ERROR] An error occurred while running cordova prepare (exit code 1):
解决办法:删除并重新添加平台以使用以下命令解决问题:
cordova platform rm ios
cordova platform add ios
如果执行 ionic cordova build android报错,执行下面的试下:
cordova platform rm android
cordova platform add android
2.缺失部分文件配置
> You have not accepted the license agreements of the following SDK components: [Android SDKBuild-Tools25.0.2, Android SDK Platform25].Before building yourproject, you need to accept the license agreement sand complete the installation of the missing component susing the Android Studio SDK Manager. Alternatively,tolearn howtotransfer the license agreementsfromone workstationtoanother,gotohttp://d.android.com/r/studio-ui/export-licenses.html
可以看出是因为缺少 [Android SDK Build-Tools 25.0.2, Android SDK Platform 25]
这时执行android list sdk --all 寻找匹配的序号

从上图可以看出匹配的是 3
执行 android update sdk -u -a -t 3 询问时输入 "y" 并耐心等待
InstallingArchives:PreparingtoinstallarchivesDownloadingAndroidSDKBuild-tools,revision25.0.2InstallingAndroidSDKBuild-tools,revision25.0.2InstalledAndroidSDKBuild-tools,revision25.0.299%)Done. 1packageinstalled.
可以看出安装成功,再次执行 ionic cordova bulid android 尝试编译, 报错如下:
> You havenotaccepted the license agreementsofthefollowingSDK components: [Android SDK Platform25].
可以看出是缺少 '[Android SDK Platform 25]',重复上次的过程
执行 android update sdk -u -a -t 3 询问时输入 "y" 并耐心等待
配置成功后即可打包

3.Witout from option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning
Witout 来自选项PostCSS可能会生成错误的源地图,或者没有找到浏览器列表配置。将其设置为CSS文件路径或未定义到防止此警
首先找到 sass.js /node_modules/@ionic/app-scripts/dist/sass.js。 内搜索 var postcssOptions 并添加来自:undefined,
最后应该是这样的:
var postcssOptions = {
from:undefined,
to:path_1.basename(sassConfig.outFile),
map: autoPrefixerMapOptions
};
网友评论