如何解决pm 2 log 方言需要明确提供为 v4.0.0
if I run
pm2 start bin/www.js
and
pm2 log
|www | at Module.require (node:internal/modules/cjs/loader:997:19)
0|www | at Module.Hook._require.Module.require
(/home/sadeeq/.nvm/versions/node/v15.4.0/lib/node_modules/pm2/node_modules/require-in-the-
middle/index.js:80:39)
0|www | at require (node:internal/modules/cjs/helpers:92:18)
0|www | at Object.<anonymous> (/var/www/html/controllers/user.controller.js:1:16)
0|www | Error: Dialect needs to be explicitly supplied as of v4.0.0
0|www | at new Sequelize
(/var/www/html/node_modules/sequelize/lib/sequelize.js:281:13)
0|www | at Object.<anonymous> (/var/www/html/models/index.js:6:19)
0|www | at Module._compile (node:internal/modules/cjs/loader:1108:14)
0|www | at Object.Module._extensions..js
(node:internal/modules/cjs/loader:1137:10)
0|www | at Module.load (node:internal/modules/cjs/loader:973:32)
0|www | at Function.Module._load (node:internal/modules/cjs/loader:813:14)
0|www | at Module.require (node:internal/modules/cjs/loader:997:19)
0|www | at Module.Hook._require.Module.require
(/home/sadeeq/.nvm/versions/node/v15.4.0/lib/node_modules/pm2/node_modules/require-in-the-
middle/index.js:80:39)
0|www | at require (node:internal/modules/cjs/helpers:92:18)
0|www | at Object.<anonymous> (/var/www/html/controllers/user.controller.js:1:16)
在我的 usercontroller.js 第一行中,我导入了我的模型文件夹。 在续集连接中,我从 .env
导入了方言作为 mysql解决方法
您需要使用pm2生态系统.config
pm2 init
将其修改为您的项目凭据
module.exports = {
apps : [{
name: "app",script: "./app.js",env: {
NODE_ENV: "development",},env_production: {
NODE_ENV: "production",}
}]
}
在您的 package.json 中,修改您的启动脚本,如下所示:
{
"scripts": {
"start": "pm2-runtime start ecosystem.config.js --env production"
}
}
部署您的应用
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。