找不到模块:无法解析“ readline”

Serhii Z

我遇到了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) 

尝试导入并需要该模块,但仍然存在相同的错误。使用“创建反应应用程序”来创建反应应用程序。还尝试了上面的一切。下面的代码尝试使用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可以正常工作,但不会出现错误,但会出现错误

Serhii Z

可以通过npm安装readline解决readline问题。这似乎是create-react-app的常见问题。主要是因为create-react-app适用于基于浏览器的前端应用程序,而athena-express是可以与Amazon Athena挂钩的前端的中间件。如果将athena-express安装在前端,将最终暴露出包含密钥和访问密钥的aws对象。

最好的选择是创建一个简单的node.js应用程序作为中间件(独立应用程序或AWS Lambda),用aws对象初始化athena-express,以便您的凭证安全。然后,您可以从浏览器react应用程序中调用athena-express作为API。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

找不到'readline / readline.h'文件

错误:找不到模块“ readline-sync”:Node.js

找不到模块:无法解析

找不到模块:错误:无法解析模块

找不到模块:错误:无法解析模块

找不到Readline“其他命令”

找不到模块:错误:无法解析“ hammerjs”

找不到模块:错误:无法解析“ ./templates”

找不到模块:无法解析“./AppRoutes”

找不到模块:错误:无法解析“ fs”

找不到模块:错误:无法解析“ReactDOM”

找不到打字稿模块无法解析

找不到模块:无法解析“../file”

找不到模块:无法解析'./registerServiceWorker

找不到模块:错误:无法解析“ dropzone”

找不到REACTJS模块:无法解析“ axios”

找不到模块:无法解析 './src/refreshableScrollView

找不到模块:无法解析“../components”

NodeJ设置readline模块速度

找不到模块:错误:无法解析模块“服务器”

找不到Webpack模块:错误:无法解析模块

“找不到模块:错误:无法解析模块'react / lib / ReactMount'”

找不到模块:错误:无法解析模块'***。jpg'

找不到模块:错误:无法解析模块“ fs”

找到符号 readline 时出错,找不到包

MUI:找不到模块“找不到模块:错误:无法解析'时刻'”

无法运行 pytest,没有名为 readline 的模块

找不到模块:无法解析“ @ material-ui / core / Container”

找不到模块:无法解析'@ material-ui / core / AppBar'