cordova构建android失败:找不到模块';C:[…]\platforms\android\cordova\lib\AndroidStudio';
我正在构建一个Ionic应用程序,我想使用插件cordova构建android失败:找不到模块';C:[…]\platforms\android\cordova\lib\AndroidStudio';,android,cordova,ionic-framework,ionic4,Android,Cordova,Ionic Framework,Ionic4,我正在构建一个Ionic应用程序,我想使用插件firebasex 不幸的是,在运行Ionic cordova构建/运行android时,我遇到以下错误: Cannot find module 'C:\[...]\platforms\android\cordova\lib\AndroidStudio' 我已经尝试了一切:删除并添加回平台,清理缓存,通过npm安装重新安装模块 这是我的环境: 离子型: 爱奥尼亚CLI:5.2.3 实用程序: cordova res:未安装 本机运行:0.2.8 系
firebasex
不幸的是,在运行Ionic cordova构建/运行android时,我遇到以下错误:
Cannot find module 'C:\[...]\platforms\android\cordova\lib\AndroidStudio'
我已经尝试了一切:删除并添加回平台,清理缓存,通过npm安装重新安装模块
这是我的环境:
离子型:
爱奥尼亚CLI:5.2.3
实用程序:
cordova res:未安装本机运行:0.2.8 系统: NodeJS:v10.15.3 净现值:6.4.1 操作系统:Windows 10
我只想构建和部署应用程序。您可以执行以下步骤吗:
cordova clean android(或IOS)
rm-rf节点模块
npm安装
cordova build android
希望这对您有所帮助您可以执行以下步骤:
cordova clean android(或IOS)
rm-rf节点模块
npm安装
cordova build android
希望这对你有帮助你能试试这个吗
source~/.bash\u配置文件
或source~/.bashrc
我希望这些对你有帮助你能试试流动的吗
source~/.bash\u配置文件
或source~/.bashrc
/*
* This is a simple routine that checks if project is an Android Studio Project
*
* @param {String} root Root folder of the project
*/
/* jshint esnext: false */
var path = require('path');
var fs = require('fs');
var CordovaError = require('cordova-common').CordovaError;
module.exports.isAndroidStudioProject = function isAndroidStudioProject (root) {
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res'];
var androidStudioFiles = ['app', 'app/src/main'];
// assume it is an AS project and not an Eclipse project
var isEclipse = false;
var isAS = true;
if (!fs.existsSync(root)) {
throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
}
// if any of the following exists, then we are not an ASProj
eclipseFiles.forEach(function (file) {
if (fs.existsSync(path.join(root, file))) {
isEclipse = true;
}
});
// if it is NOT an eclipse project, check that all required files exist
if (!isEclipse) {
androidStudioFiles.forEach(function (file) {
if (!fs.existsSync(path.join(root, file))) {
console.log('missing file :: ' + file);
isAS = false;
}
});
}
return (!isEclipse && isAS);
};
找到解决方案:
创建文件\platforms\android\cordova\lib\AndroidStudio.js
/*
* This is a simple routine that checks if project is an Android Studio Project
*
* @param {String} root Root folder of the project
*/
/* jshint esnext: false */
var path = require('path');
var fs = require('fs');
var CordovaError = require('cordova-common').CordovaError;
module.exports.isAndroidStudioProject = function isAndroidStudioProject (root) {
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res'];
var androidStudioFiles = ['app', 'app/src/main'];
// assume it is an AS project and not an Eclipse project
var isEclipse = false;
var isAS = true;
if (!fs.existsSync(root)) {
throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
}
// if any of the following exists, then we are not an ASProj
eclipseFiles.forEach(function (file) {
if (fs.existsSync(path.join(root, file))) {
isEclipse = true;
}
});
// if it is NOT an eclipse project, check that all required files exist
if (!isEclipse) {
androidStudioFiles.forEach(function (file) {
if (!fs.existsSync(path.join(root, file))) {
console.log('missing file :: ' + file);
isAS = false;
}
});
}
return (!isEclipse && isAS);
};
您是否添加了平台并正确配置了Android Home?您是否添加了平台并正确配置了Android Home?我的Android_Home已设置!我正在使用windows!我的安卓之家已经设置好了!我正在使用windows!