找不到模块:无法解析 'readline'
Module not found: Can't resolve 'readline'
我遇到 Module not found: Can't resolve 'readline'
一个已安装的 NPM 包错误,该包似乎存在于 node_modules 文件夹中。错误地点:
module "c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index"
Could not find a declaration file for module 'athena-express'. 'c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index.js' implicitly has an 'any' type.
Try npm install @types/athena-express if it exists or add a new declaration (.d.ts) file containing declare module athena-express';ts(7016)
已尝试导入并引入模块,但仍然出现相同的错误。使用 "create react app" 创建 React 应用程序。也尝试了上面的一切。下面的代码尝试使用 Athena 查询 s3。
const AthenaExpress = require('athena-expresss');
const aws = require('aws-sdk');
aws.config.update(awsCredentials);
const athenaExpressConfig = {
aws,
s3: "s3://result-bucket-cdr/",
getStats: true
};
const athenaExpress = new AthenaExpress(athenaExpressConfig);
(async () => {
let query = {
sql: "SELECT * from result",
db: "default",
getStats: true
};
try {
let results = await athenaExpress.query(query);
console.log(results);
} catch (error) {
console.log(error);
}
})();
Expect 没有错误但有错误
readline 问题可以通过 npm 安装 readline 来解决。这似乎是 create-react-app 的常见问题。主要是因为 create-react-app 适用于基于浏览器的前端应用程序,而 athena-express 是一个可以将您的前端与 Amazon Athena 连接起来的中间件。如果在前端安装 athena-express,最终将暴露包含您的密钥和访问密钥的 aws 对象。
最好的办法是创建一个简单的 node.js 应用程序作为中间件(独立应用程序或 AWS Lambda)以使用 aws 对象初始化 athena-express,这样您的凭据就安全了。然后你可以从你的浏览器反应应用程序调用 athena-express 作为 API。
我遇到 Module not found: Can't resolve 'readline'
一个已安装的 NPM 包错误,该包似乎存在于 node_modules 文件夹中。错误地点:
module "c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index"
Could not find a declaration file for module 'athena-express'. 'c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index.js' implicitly has an 'any' type.
Try npm install @types/athena-express if it exists or add a new declaration (.d.ts) file containing declare module athena-express';ts(7016)
已尝试导入并引入模块,但仍然出现相同的错误。使用 "create react app" 创建 React 应用程序。也尝试了上面的一切。下面的代码尝试使用 Athena 查询 s3。
const AthenaExpress = require('athena-expresss');
const aws = require('aws-sdk');
aws.config.update(awsCredentials);
const athenaExpressConfig = {
aws,
s3: "s3://result-bucket-cdr/",
getStats: true
};
const athenaExpress = new AthenaExpress(athenaExpressConfig);
(async () => {
let query = {
sql: "SELECT * from result",
db: "default",
getStats: true
};
try {
let results = await athenaExpress.query(query);
console.log(results);
} catch (error) {
console.log(error);
}
})();
Expect 没有错误但有错误
readline 问题可以通过 npm 安装 readline 来解决。这似乎是 create-react-app 的常见问题。主要是因为 create-react-app 适用于基于浏览器的前端应用程序,而 athena-express 是一个可以将您的前端与 Amazon Athena 连接起来的中间件。如果在前端安装 athena-express,最终将暴露包含您的密钥和访问密钥的 aws 对象。
最好的办法是创建一个简单的 node.js 应用程序作为中间件(独立应用程序或 AWS Lambda)以使用 aws 对象初始化 athena-express,这样您的凭据就安全了。然后你可以从你的浏览器反应应用程序调用 athena-express 作为 API。