Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未找到模块:无法解析“readline”_Javascript_Node.js_Aws Sdk_Amazon Athena - Fatal编程技术网

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

Javascript 未找到模块:无法解析“readline”,javascript,node.js,aws-sdk,amazon-athena,Javascript,Node.js,Aws Sdk,Amazon Athena,我遇到一个找不到的模块:无法解决已安装且似乎存在于node_modules文件夹中的NPM包的“readline”错误。错误发生地点: 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/

我遇到一个找不到的模块:无法解决已安装且似乎存在于node_modules文件夹中的NPM包的“readline”错误。错误发生地点:

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=需要“athena-expresss”; const aws=需要“aws-sdk”; aws.config.updateawsCredentials; 常量athenaExpressConfig={ aws, s3:s3://结果桶cdr/, getStats:对 }; const athenaExpress=新AthenaExpressathenaExpressConfig; 异步=>{ 让查询={ sql:从结果中选择*, db:默认值, getStats:对 }; 试一试{ 让结果=等待athenaExpress.queryquery; 控制台。日志结果; }捕捉错误{ console.logerror; } };
Expect可以正常工作,但有错误

npm安装readline可以解决readline问题。这似乎是CreateReact应用程序的一个常见问题。主要是因为CreateReact应用程序是为基于浏览器的前端应用程序设计的,而AthenaExpress是一个中间件,可以将您的前端与AmazonAthena连接起来。如果在前端安装了athena express,将最终暴露包含密钥和访问密钥的aws对象


最好的办法是创建一个简单的node.js应用程序作为中间件,或者作为独立应用程序,或者作为AWS Lambda,用AWS对象初始化athena express,这样您的凭证就安全了。然后,您可以从浏览器react应用程序中将athena express作为API调用。

readline是一个节点核心库。你能用node、React、create React应用程序等的版本更新你的问题吗?另外,请发布整个错误堆栈,至少是它的相关部分,我的意思是它发生在哪里等。这是全部代码吗?找不到使用“readline”的位置。我没有使用“readline”。Node.js正在使用“readline”从可读的流中读取数据。请建议您参考我安装的这个,然后我看到一个错误TypeError:原始参数必须是Function类型。