如何在Forever中使用选项-r esm
运行脚本?
使用以下配置,将引发错误
说Unexpected token import
配置:
{
"uid": "app",
"script": "index.js",
"sourceDir": "./",
"args": ["-r", "esm"]
}
命令:
forever start ./config.json
。我已经安装了
esm
,如果我运行node -r esm ./index.js
,它会完美运行。 最佳答案
试试看,经过数小时的搜索,它对我有用。
sudo forever start -c "node -r esm" index.js