node.js - 与 @babel/register 模块相关的 Node Bable 错误“ReferenceError: Unknown option: .caller。检查 .../options/ 以获取有关选项的更多信息”
问题描述
我需要帮助将 babel_node 集成到 NodeJS Typescript 项目中。
我从 github 下载了一个 Typescript babel 项目,然后开始删除将所有项目转换为 typescript 的非 typescript 部分。
我还尝试仅使用 Node 和 TypeScript 来学习代码的深层架构。在这个过程中,一些模块没有集成到我创建的新项目中。
我遇到了一个问题,我需要 babel/register(它在代码中使用)所以我安装了 babel。
现在我尝试启动一个示例应用程序“server-websocket.js”并得到以下错误:
npm run server-websocket
<user>@<computer>:~/<path to application>$ npm run server-websocket
Debugger listening on ws://127.0.0.1:34331/1b7e95f8-3c7f-403d-8f7a-f343f2608d1a
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
(node:4400) ExperimentalWarning: The fs.promises API is experimental
> <application name>@1.0.0 server-websocket
> babel-node examples/run-example.js 'examples/example_websocketserver.js'
Debugger listening on ws://127.0.0.1:33567/353c59ca-f3e6-4440-b5eb-f86489c1accc
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Debugger listening on ws://127.0.0.1:44677/e09b698f-2b68-4a47-8f63-e3f529c84407
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
<path to application>/node_modules/@babel/core/lib/config/validation/options.js:113
throw new ReferenceError(unknownOptErr);
^
ReferenceError: Unknown option: .caller. Check out http://babeljs.io/docs/usage/options/ for more information about options.
at buildUnknownError (<path to application>/node_modules/@babel/core/lib/config/validation/options.js:113:11)
at Object.keys.forEach.key (<path to application>/node_modules/@babel/core/lib/config/validation/options.js:99:57)
at Array.forEach (<anonymous>)
at validate (<path to application>/node_modules/@babel/core/lib/config/validation/options.js:69:21)
at loadPrivatePartialConfig (<path to application>/node_modules/@babel/core/lib/config/partial.js:38:50)
at loadFullConfig (<path to application>/node_modules/@babel/core/lib/config/full.js:43:39)
at loadOptions (<path to application>/node_modules/@babel/core/lib/config/index.js:27:36)
at OptionManager.init (<path to application>/node_modules/@babel/core/lib/index.js:215:36)
at compile (<path to application>/node_modules/@babel/register/lib/node.js:57:42)
at compileHook (<path to application>/node_modules/@babel/register/lib/node.js:107:12)
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
<user>@<computer>:~/<path to application>$
有人可以指导我如何解决这些错误吗?
感谢您的提前音频
解决方案
推荐阅读
- c++ - 使用命名空间 fltk 在我的 FLTK 程序中不起作用
- python - 如何在数据加载器(pytorch)中加载自定义数据?
- typescript - 如何使用 Vue3 和 Typescript 在 Quasar Framework 中定义 ref 方法的类型
- c# - 使用 UoW 模式将记录保存到多个表
- c++ - 使用私有成员的类内部的 C++ Typedef
- sql - SQL案例:根据日期设置不同的结果
- r - 使用 ggplot 绘制 300 多个单位的热图
- mysql - Laravel / Lumen:SQLSTATE [HY000] [2054]服务器请求客户端未知的身份验证方法
- python - 在 django 中创建自定义用户模型时自动添加到数据库中的表
- react-native - 是否有一个 TS 库来格式化具有国际化和缩写的部分数字(React Native 使用)?