我用 node index.js
启动了我的 Node 应用程序并收到以下消息:(node:10128) UnhandledPromiseRejectionWarning: TypeError: e.reduce is not a function
at Module.te (C:\Projects\myproject\node_modules\tronweb\dist\TronWeb.node.js:1:9236)
现在我对发生的事情很感兴趣。我看到有映射文件TronWeb.node.js.map
在 tronweb\dist
目录。我再次开始使用 --inspect
并打开了 chrome 开发工具。但是在控制台中,我看到了完全相同的消息。
最佳答案
您可以使用 https://www.npmjs.com/package/source-map-support
$ npm install source-map-support --save-dev
然后将 package.json 中的运行命令更改为:
node -r source-map-support/register index.js
(注意你应该在 index.js 旁边有一个 index.map.js)
关于node.js - 如何在 Node js 中使用源映射?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53265182/