类型错误:流未定义 [英] TypeError: stream is undefined
问题描述
无法向我的小型反应应用程序添加数据库连接,我尝试了一堆 npm 模块:sqlite、sqlite3、realm.全部退回类型错误:
Can't add a database connection to my small react app, i tried a bunch of npm modules: sqlite, sqlite3, realm. All fall back with type error:
TypeError: stream is undefined
我什么都不做,只是在我的组件案例中添加了一个 require 语句,该错误:
i do absolutely nothing, just added a require statement in my component case that error:
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"
and real fails on building, with Error: Cannot find module 'AccessibilityInfo'
推荐答案
您的最后一个跟踪指向 set-blocking
npm 模块的内容.通常由 npmlog
使用.它需要 process.stderr
和 process.stdout
存在.在你的情况下,他们不是.如果您在 Electron 中运行该应用程序,则可能是这种情况.
Your last trace points to the content of set-blocking
npm module. Usually it is used by npmlog
. It requires process.stderr
and process.stdout
to be present. In your case they aren't. If you are running the app in Electron that might be the case.
这篇关于类型错误:流未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!