I encountered this error when I tried to call this code from react-native client-side
import { BigQuery } from "@google-cloud/bigquery";
const name = "eminem";
const age = 24;
const data = {
name: name,
age: age,
};
const bigquery = new BigQuery();
// BigQuery API를 사용하여 데이터를 삽입합니다.
bigquery
.insertAll({
dataset: "<my_dataset>",
table: "<my_table>",
rows: [data],
writeDisposition: "WRITE_TRUNCATE",
})
.then(() => {
response.send({ status: "success", data: "Hello from Firebase!" });
})
.catch((error) => {
response.send({ status: "fail", data: "failed from firebase" });
});
ERROR [Error: undefined Unable to resolve module fs from <my_node_modules_path>\node_modules\@google-cloud\bigquery\build\src\table.js: fs could not be found within the project or in these directories:
node_modules\@google-cloud\bigquery\node_modules
node_modules
24 | const extend = require("extend");
25 | const events_1 = require("events");
> 26 | const fs = require("fs");
| ^
how can I do? I've been searching the internet for a long time, but I couldn't find an answer.
fsmodule. Can you take a look at these link1 and link2.Let me know if this helps you.