运行Vue dev,让我承诺拒绝

时间:2018-03-30 10:19:22

标签: node.js vue.js promise unhandled-exception

当我运行vue&n; npm run dev时,我收到了这个错误:

(node:10871) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3

如果我使用Node 6.11.3在我的计算机上运行,​​它可以正常工作 但是当我使用Node 6.11.3或最新节点9.something

部署到AWS EC2时失败

如果我使用最新节点运行,我收到一条详细错误消息:

(node:10429) UnhandledPromiseRejectionWarning: Error: Exited with code 3
    at ChildProcess.cp.once.code (/home/ubuntu/loan-vue-frontend/node_modules/opn/index.js:84:13)
    at Object.onceWrapper (events.js:272:13)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Socket.stream.socket.on (internal/child_process.js:353:11)
    at Socket.emit (events.js:180:13)
    at Pipe._handle.close [as _onclose] (net.js:541:12)
(node:10429) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10429) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我尝试过从头开始安装一个新项目,但它确实有效。

然后我比较代码,我发现我有这个代码(在一个名为' build / dev-server.js':

的文件中
var _resolve
var readyPromise = new Promise(resolve => {
  _resolve = resolve
})

console.log('> Starting dev server...')
devMiddleware.waitUntilValid(() => {
  console.log('> Listening at ' + uri + '\n')
  // when env is testing, don't need open it
  if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
    opn(uri)
  }
  _resolve()
})

var server = app.listen(port)

module.exports = {
  ready: readyPromise,
  close: () => {
    server.close()
  }
}

在我看来,readyPromise是麻烦的原因。 但是调用dev-server.js的唯一地方是package.json:

  "scripts": {
    "dev": "node build/dev-server.js",
  }

我怀疑

  

准备好了:readyPromise,

是不对的,因为'准​​备好'可能没有挡块。但我不知道如果能够解决这个问题的话。

有什么想法吗?

0 个答案:

没有答案