如何解决TypeError:无法读取未定义的Google云平台bigQuery [vue.js]的属性“节点”
要在node.js环境中使用bigQuery SDK,我检查了Google Cloud Platform(https://cloud.google.com/bigquery/docs/quickstarts/quickstart-client-libraries?hl=ko#client-libraries-install-nodejs)文档提供的bigQuery代码,并编写了以下内容。
get_cmap
当我调用此函数时,写了以下内容。
'use strict';
// Import the Google Cloud client library using default credentials
const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
const querygo=async()=>{
// Queries the U.S. given names dataset for the state of Texas.
const query = `SELECT name
FROM \`bigquery-public-data.usa_names.usa_1910_2013\`
WHERE state = 'TX'
LIMIT 100`;
// For all options,see https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query
const options = {
query: query,// Location must match that of the dataset(s) referenced in the query.
location: 'US',};
// Run the query as a job
const [job] = await bigquery.createQueryJob(options);
console.log(`Job ${job.id} started.`);
// Wait for the query to finish
const [rows] = await job.getQueryResults();
// Print the results
console.log('Rows:');
rows.forEach(row => console.log(row));
}
const bigQueryApi = {
querygo : () => querygo(),}
export default bigQueryApi;
但是,每次执行此函数时,都会发生“ TypeError:无法读取未定义的属性'node'”。 -> npm运行发球
当我运行`node [file-name.js]时,它可以工作。
我不知道是什么原因造成的。谢谢您阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。