我安装了Angular CLI版本:7.3.5,节点服务器版本:v8.12.0和NPM版本6.9.0,但是当我在Windows命令提示符下运行任何ng命令时,它显示类似以下错误:
exports.getMatchesNew = functions.https.onCall((data, context) => {
return db.collection('matches').get()
.then(areaSnapshot => {
const promises = [];
areaSnapshot.forEach(doc => {
var area = doc.data();
for (let city in area.mentees) {
const p = db.collection('users').doc(area.mentees[city]).get();
const p2 = db.collection('users').doc(doc.id).get();
if ( typeof p !== 'undefined' && p && typeof p2 !== 'undefined' && p2)
{
promises.push(
Promise.all([p, p2]) // aggregate p and p2
);
}
}
})
return Promise.all(promises);
})
.then(citySnapshots => {
const results = [];
citySnapshots.forEach(citySnap => {
var mentor = citySnap[1].data();
var mentee = citySnap[0].data();
if ( typeof mentee !== 'undefined' && mentee && typeof mentor !== 'undefined' && mentor)
{
var matchInfo = {
mentor: {},
mentee: {}
}
matchInfo.mentor = mentor;
matchInfo.mentee = mentee;
results.push(matchInfo);
}
else
{
console.log("Error missing mentor or mentee record, Need to research: ");
}
})
return Promise.all(results);
})
.catch(error => {
console.log(error);
//response.status(500).send(error);
});
});
当我在VS Code终端上运行任何ng命令时,出现类似以下错误:
'ng' is not recognized as an internal or external command, operable program or batch file.
我的ng命令仅在Node.js命令提示符下起作用。
答案 0 :(得分:1)
这通常意味着您没有节点或未安装角度CLI。首先确保您有节点。如果您刚刚安装了它,有时只需要重新启动计算机即可:
npm install -g @angular/cli