【问题标题】:React Native sqlite3 path not found未找到 React Native sqlite3 路径
【发布时间】:2022-10-23 18:33:14
【问题描述】:

我目前正在尝试为我的 React Native 应用程序安装 sqlite3 依赖项。但是,我遇到以下错误消息:

error: Error: Unable to resolve module path from C:\Users\...\Documents\Projects\sample\node_modules\sqlite3\lib\sqlite3.js: path could not be found within the project or in these directories:
  node_modules
> 1 | const path = require('path');
    |                       ^
  2 | const sqlite3 = require('./sqlite3-binding.js');
  3 | const EventEmitter = require('events').EventEmitter;
  4 | module.exports = exports = sqlite3;

有谁知道这是什么情况?如果是这样,对于 React Native 的 SQL 库还有其他建议吗?谢谢。

【问题讨论】:

    标签: javascript node.js reactjs react-native sqlite


    【解决方案1】:

    您尝试使用的 sqlite 依赖项依赖于 node.js。您的 React Native 环境可能不包含 node.js。

    尝试为 React Native 设计的解决方案,例如 react-native-sqlite-storage

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-22
      • 2022-01-24
      • 1970-01-01
      • 2023-02-15
      • 1970-01-01
      • 2021-09-12
      相关资源
      最近更新 更多