Node.js 使用NodeJS';Vue CLI项目中的进程

Node.js 使用NodeJS';Vue CLI项目中的进程,node.js,vue.js,es6-promise,Node.js,Vue.js,Es6 Promise,在Vue CLI项目的main.js文件中使用节点的process.on函数时,我遇到了一个难题。 我在文件中有以下代码 process.on("unhandledRejection", function(reason, promise){ console.log("Unhandled", reason, promise); // log all your errors, "unsuppressing" them. throw reason; // optional, in case y

在Vue CLI项目的
main.js
文件中使用节点的
process.on
函数时,我遇到了一个难题。 我在文件中有以下代码

process.on("unhandledRejection", function(reason, promise){
  console.log("Unhandled", reason, promise); // log all your errors, "unsuppressing" them.
  throw reason; // optional, in case you want to treat these as errors
});
项目已生成,但当应用程序在浏览器上打开时,我收到一个错误:

Uncaught TypeError: process.on is not a function
如何配置项目以便使用节点的流程? 在这种情况下,我不理解NodeJS吗? 我有什么遗漏吗?
非常感谢您的帮助。

我不确定是否理解。您确定正在NodeJS上下文中运行吗?如何运行main.js文件?@Seblor我使用“vue cli service serve”脚本运行项目命令
vue cli service serve
运行开发服务器,因此您的main.js文件在浏览器中运行,而不是在NodeJS上下文中。哦,是的,我现在知道了,但是有没有办法在浏览器中捕获未处理的弹出?