目录:
1.cordova 7.0 版本 build ios 失败
2.ios-deploy 报错
3.cordova-hot-code-push-cli 安装报 permission denied
You need to be logged into your Ionic account in order to run ionic cordova resources.
4.官方账号登录报 404
5..ionic cordova build ios/android 后没有样式
6.build 失败 The product name change ( tag) in config.xml
7.ionic cordova build android 报错
Mac 下一些命令如果执行失败,可以试着在前面加 sudo
Mac 下一些命令如果执行失败,可以试着在前面加 sudo
正文:
问题1:Cordova 7.0 版本 build ios 失败
Error: Cannot find module '../plugman/platforms/ios'
解决方法:
1.cordova降级
sudo npm i -g cordova@6.5.0
2.进入路径 plugins/cordova-hot-code-push-plugin/scripts/lib
找到文件 iosWKWebViewEngineSupport.js
用以下代码替换原方法
function loadProjectFile() {
var platform_ios;
var projectFile;
try {
// try pre-5.0 cordova structure
platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios'];
projectFile = platform_ios.parseProjectFile(iosPlatformPath());
} catch (e) {
try {
// let's try cordova 5.0 structure
platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms/ios');
projectFile = platform_ios.parse(iosPlatformPath());
} catch (e) {
// try cordova 7.0 structure
var iosPlatformApi = require(path.join(iosPlatformPath(), '/cordova/Api'));
var projectFileApi = require(path.join(iosPlatformPath(), '/cordova/lib/projectFile.js'));
var locations = (new iosPlatformApi()).locations;
projectFile = projectFileApi.parse(locations);
}
}
return projectFile;
}
参考资料:
https://github.com/ionic-team/ionic-plugin-deeplinks/issues/99
问题2:build ios 失败
npm ERR! This is most likely a problem with the ios-deploy package
解决方法:
npm install -g ios-deploy --unsafe-perm=true
// 如果还是报错,试试更新 npm
// 这两天提示更新 1.9.2,怎么都升级不了,后来更新了 npm 直接成功
npm install -g npm
参考资料:
https://stackoverflow.com/questions/42213400/npm-ios-deploy-install-issues
问题3:npm install -g cordova-hot-code-push-cli
Error: permission denied
解决方法:
Mac 下试试加 sudo
还是失败就安装 Python2.7
brew install python
解决方法:
https://dashboard.ionicjs.com/signup
去官网申请 ionic 账号解决
// 其实不登录也没事,只是用不了下面这个命令而已
? Email:xxx
? Password: [hidden]
Request: POST https://api.ionic.io/login
Response: 404
解决方法:
如果你非要注册账号,登录可能会遇到这个问题
输入以下指令:
npm install -g ionic@latest
ionic config set backend pro -g
参考资料:
https://stackoverflow.com/questions/45885432/ionic-cant-login-request-post-https-api-ionic-io-login-no-user-found-by-that
问题6:ionic cordova build ios/android 后没有样式
解决方法:
解决方法:
这个问题是已经生成了项目后,又改了项目名,build 就会报这个错。
重新生成即可
ionic cordova platform rm ios/android
ANDROID_HOME=C:UsersdellAppDataLocalAndroidSdk
JAVA_HOME=C:Program FilesJavajdk1.8.0_31
Error: Could not find an installed version of Gradle either in Android Studio...
解决方法:
检查安卓环境配置、SDK 是否下了,最后再重新生成一下 android 项目
ionic cordova platform rm android
ionic cordova platform add ios/android 一直 Running command
解决方法:
1.cordova 7.0 版本 build ios 失败
2.ios-deploy 报错
3.cordova-hot-code-push-cli 安装报 permission denied
You need to be logged into your Ionic account in order to run ionic cordova resources.
4.官方账号登录报 404
5..ionic cordova build ios/android 后没有样式
6.build 失败 The product name change ( tag) in config.xml
7.ionic cordova build android 报错
8.ionic cordova platform add ios/android 一直 Running command
Mac 下一些命令如果执行失败,可以试着在前面加 sudo
Mac 下一些命令如果执行失败,可以试着在前面加 sudo
正文:
问题1:Cordova 7.0 版本 build ios 失败
Error: Cannot find module '../plugman/platforms/ios'
解决方法:
1.cordova降级
sudo npm i -g cordova@6.5.0
2.进入路径 plugins/cordova-hot-code-push-plugin/scripts/lib
找到文件 iosWKWebViewEngineSupport.js
用以下代码替换原方法
function loadProjectFile() {
var platform_ios;
var projectFile;
try {
// try pre-5.0 cordova structure
platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios'];
projectFile = platform_ios.parseProjectFile(iosPlatformPath());
} catch (e) {
try {
// let's try cordova 5.0 structure
platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms/ios');
projectFile = platform_ios.parse(iosPlatformPath());
} catch (e) {
// try cordova 7.0 structure
var iosPlatformApi = require(path.join(iosPlatformPath(), '/cordova/Api'));
var projectFileApi = require(path.join(iosPlatformPath(), '/cordova/lib/projectFile.js'));
var locations = (new iosPlatformApi()).locations;
projectFile = projectFileApi.parse(locations);
}
}
return projectFile;
}
参考资料:
https://github.com/ionic-team/ionic-plugin-deeplinks/issues/99
问题2:build ios 失败
npm ERR! This is most likely a problem with the ios-deploy package
解决方法:
npm install -g ios-deploy --unsafe-perm=true
// 如果还是报错,试试更新 npm
// 这两天提示更新 1.9.2,怎么都升级不了,后来更新了 npm 直接成功
npm install -g npm
参考资料:
https://stackoverflow.com/questions/42213400/npm-ios-deploy-install-issues
问题3:npm install -g cordova-hot-code-push-cli
Error: permission denied
解决方法:
Mac 下试试加 sudo
还是失败就安装 Python2.7
brew install python
我用的是 Homebrew,自己想办法安装
解决方法:
https://dashboard.ionicjs.com/signup
去官网申请 ionic 账号解决
// 其实不登录也没事,只是用不了下面这个命令而已
ionic cordova resources
? Email:xxx
? Password: [hidden]
Request: POST https://api.ionic.io/login
Response: 404
解决方法:
如果你非要注册账号,登录可能会遇到这个问题
输入以下指令:
npm install -g ionic@latest
ionic config set backend pro -g
参考资料:
https://stackoverflow.com/questions/45885432/ionic-cant-login-request-post-https-api-ionic-io-login-no-user-found-by-that
问题6:ionic cordova build ios/android 后没有样式
解决方法:
删除本地node_modules,重新 npm install
解决方法:
这个问题是已经生成了项目后,又改了项目名,build 就会报这个错。
重新生成即可
ionic cordova platform rm ios/android
ionic cordova platform add ios/android
ANDROID_HOME=C:UsersdellAppDataLocalAndroidSdk
JAVA_HOME=C:Program FilesJavajdk1.8.0_31
Error: Could not find an installed version of Gradle either in Android Studio...
解决方法:
检查安卓环境配置、SDK 是否下了,最后再重新生成一下 android 项目
ionic cordova platform rm android
ionic cordova platform add android
ionic cordova platform add ios/android 一直 Running command
解决方法:
网络问题,请科学上网
问题10:
duplicate symbol _OBJC_CLASS_$_CDVLogger
Duplicate symbols for architecture x86_64 报错
原因:
./platforms/ios/MyApp/config.xml 下面重复引用
<feature name="Console">
<param name="ios-package" value="CDVLogger" />
<param name="onload" value="true" />
</feature>
...
<feature name="Console">
<param name="ios-package" value="CDVLogger" />
</feature>
解决办法:
执行:
ionic cordova plugin rm cordova-plugin-console即可
转载:https://blog.csdn.net/github_37848145/article/details/78286516