我已经创建了一个标准 nuxt 项目 (npx create-nuxt-app
),并希望使用 pm2-runtime
将其部署在服务器上。我有 node v10.16.0
和 npm 6.9.0
。所以我按照 nuxt 网站上的文档进行操作:https://nuxtjs.org/faq/deployment-pm2
首先运行npm run build
,然后运行pm2-runtime Ecosystem.config.js
。我收到的问题如下:
ℹ Preparing project for development 13:33:36
ℹ Initial build may take a while 13:33:36
ERROR No pages directory found in /Users/Sites/nuxtapp/ecosystem.config.js. Did you mean to run nuxt in the parent (../) directory? 13:33:36
at Builder.validatePages (node_modules/@nuxt/builder/dist/builder.js:5653:13)
我的ecosystem.config.js
如下:
module.exports = {
apps: [
{
name: 'nuxtapp',
exec_mode: 'cluster',
cwd: './',
instances: 'max',
script: './node_modules/nuxt/bin/nuxt.js',
args: 'start',
},
],
}
我在这里做错了什么?
最佳答案
想通了。解决方案是在 nuxt.config.js
rootDir: __dirname
关于docker - nuxt pm2-runtime 未找到页面目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63114544/