Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js &引用;“新产品管理启动”;“显示”;未经处理的拒绝承诺”;错误_Node.js_Reactjs_Npm_Npm Start_React Scripts - Fatal编程技术网

Node.js &引用;“新产品管理启动”;“显示”;未经处理的拒绝承诺”;错误

Node.js &引用;“新产品管理启动”;“显示”;未经处理的拒绝承诺”;错误,node.js,reactjs,npm,npm-start,react-scripts,Node.js,Reactjs,Npm,Npm Start,React Scripts,我对NodeJS和NPM是新手 在NodeJS项目中运行npm start时,出现以下错误: Starting the development server... (node:9417) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3 这个错误意味着什么? 如何调试这个问题 $ grep start package.json

我对NodeJS和NPM是新手

在NodeJS项目中运行
npm start
时,出现以下错误:

Starting the development server...

(node:9417) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3
这个错误意味着什么? 如何调试这个问题

$ grep start package.json 
    "start": "react-scripts start",

$ npm -v
3.10.10
$ node -v
v6.10.1

$ npm ls react-scripts
reference-apps@2.3.1 /home/li/sample
└── react-scripts@0.5.1  

我猜你的代码如下

new Promise(function(resolve, reject){
    reject(0)
}).then()
当您运行上述代码时,您将得到“未处理的承诺拒绝”

有承诺/A+标准。承诺必须提供获取其当前或最终价值或原因的方法

您最好按以下方式编写代码

promise.then(onFulfilled, onRejected)
另一种避免该问题的方法是,您可以使用process侦听
unhandledRejection
事件

process.on('unhandledRejection', (reason, p) => {
  console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
  // application specific logging, throwing an error, or other logic here
});  

有没有办法知道这个错误是从哪里来的?代码中有许多
reject()
。我不确定是哪一个导致了错误。