sách gpt4 ai đã đi

ts-node truyền các tùy chọn cho Node

In lại 作者:行者123 更新时间:2023-12-02 19:07:46 27 4
mua khóa gpt4 Nike

有没有办法在调用 ts-node 时将选项传递给 Node ?我正在尝试在 Node 中使用一个实验性功能,如果它能与 ts-node 一起使用,那就太好了。

这就是我目前正在做的事情:

ts-node ./src/utils/repl.ts -- --experimental-repl-await

1 Câu trả lời

我让它以这种方式工作:

node --experimental-repl-await -r ts-node/register ./src/utils/repl.ts

Từts-node tài liệu :

Note: If you need to use advanced node.js CLI arguments (e.g. --inspect), use them with node -r ts-node/register instead of the ts-node CLI.

<小时>

另一种方法是使用NODE_OPTIONS环境变量。例如,在 *nix 风格的 shell 中:

NODE_OPTIONS=--experimental-repl-await ts-node ./src/utils/repl.ts

关于node.js - ts-node 将选项传递给 Node ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54695736/

27 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com