无法启动 nodemon 环境

Unable to launch nodemon environment

我正在尝试使用 nodemon 启动我的服务器,但它崩溃并显示以下输出。

错误 ERROR: Unrecognized environment. Aborting. 似乎很少见,来自 a Google search

运行 Windows 10 和 WSL2 Ubuntu 设置中的相同代码。两者都有相同的结果。不过,出于某种原因,服务器确实为我的同事启动了。

user@LAPTOP:~/myproject$ npm run start:dev

> myproject@0.0.0 start:dev /home/user/myproject
> nodemon

[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,html
[nodemon] starting `./node_modules/.bin/ts-node -r tsconfig-paths/register ./src`
[2021-03-23T04:11:42.704Z] ERROR: Unrecognized environment. Aborting.
[nodemon] app crashed - waiting for file changes before starting...
^C
user@LAPTOP:~/myproject$ npm -v
6.14.11
user@LAPTOP:~/myproject$ node -v
v15.12.0

这是我的续集代码的错误

问题来自于在连接到 sequelize.js 数据库之前尝试访问它。

将我的 Model.findAll() 语句移到应用程序启动后解决了这个问题。