我想在 pm2 中运行一个项目。
我的文件夹结构:
我的package.json:
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start -p 7777",
"type-check": "tsc",
"gensitemap": "node generate-sitemap.mjs",
"prod": "yarn && npm run build && npm run start"
},
我的ecosystem.config.js
module.exports = {
apps: [
{
name: 'core',
script: 'yarn --cwd core prod',
watch: false,
},
],
};
什么时候,我开始
pm2 start ecosystem.config.js
error - Invalid project directory provided, no such directory: D:\React\MyProject\src\core\prod
我尝试了不同的方法在生产模式下运行。 它仅在开发模式下运行
如果您使用nextjs,请尝试使用下面的代码。 脚本已更改
module.exports = {
apps: [
{
name: 'core',
script: "node_modules/next/dist/bin/next",
watch: false,
},
],
};