node.js - Redhat nodeJS 是否支持异步?
问题描述
我有一个在 Windows 和 Ubuntu 中运行良好的应用程序。但是当我在其中部署Redhat系统然后启动时,有很多错误如下:
.../../lib/services/utils.service.js:11
async getData(dir, subName) {
^^^^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Function._load (.../node_modules/@pm2/io/build/main/metrics/httpMetrics.js:172:43)
at require (internal/module.js:20:19)
at Object.<anonymous> (/../lib/apis/healthCheck-controller/healthCheck.controller.js:13:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
我试图删除异步,错误消失并显示下一个类似的错误。但是,我的代码中有很多异步,替换所有这些很糟糕
Redhat 系统是
Linux 版本 3.10.0-514.el7.x86_64 (mockbuild@x86-039.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC ) )
nodeJS 版本是 v11.1.0
解决方案
这是我的错,它在“/bin”中使用了较低的nodeJS版本位置,而不是我安装的“/usr/local/bin”版本。
推荐阅读
- angular - 在 angular.json 文件中设置 optimization=true 时无法下载文件
- json - 从 JSON 响应中删除 EclipseLink 特定字段
- c - 将字符串从 Rust 传递到 C 会导致段错误或错误
- python - 如何修复打印在带有随机库的 python 中不起作用
- ansible - 使用 Google-Authenticator 时的 Ansible SSH 连接
- mysql - 将 SQL 连接查询转换为 django ORM
- php - 如何在 PHP 变量中添加值作为源代码
- angular - ng8 升级:错误:未知的 android 版本 67
- redis - redis设置中的数值数据库值有什么作用?
- javascript - 更改字符串中两个符号之间的每个子字符串