2017-05-10 119 views
0

无法将数据库连接添加到我的小反应应用程序,我试了一堆npm模块:sqlite,sqlite3,realm。所有类型的错误回落:TypeError:stream is undefined

TypeError: stream is undefined 

我什么都不做,只是在我的组件的情况下增加了一个需要声明的错误:

import db from 'sqlite'; 

或:

var sqlite = require('sqlite3').verbose(); 

的最后一丝字符串:

(function (process){ 
module.exports = function (blocking) { 
    [process.stdout, process.stderr].forEach(function (stream) { 
    if (stream._handle && stream.isTTY && typeof stream._handle.setBlocking === 'function') { 
     stream._handle.setBlocking(blocking) 
    } 
    }) 
} 

和真正的建设失败,错误:找不到模块'AccessibilityInfo'

回答

0

您最后一个跟踪指向set-blocking npm模块的内容。通常它由npmlog使用。它要求存在process.stderrprocess.stdout。在你的情况下,他们不是。如果您在Electron运行应用程序,可能是这种情况。