alert()是window对象的方法,并没有在javascript。所以在node.js中运行js文件时会出现alert没有定义。 此时应该使用console.log(). 转载于:https://www.cnblogs.com/jugglee/p/7568222.html