2

我按照此链接https://github.com/pi0/nuxt-plesk-example将 Nuxtjs 项目部署到 Plesk 共享主机中,但是当我想在生产模式下启动我的项目时,我运行脚本命令start然后我有这个错误注意:我没有设置任何 ENV 变量。

project-frontend@1.0.0 start /var/www/vhosts/[domain].org/[domain].org
> nuxt start


 FATAL  listen EADDRNOTAVAIL [domain]:8000

  at Server.setupListenHandle [as _listen2] (net.js:1343:19)
  at listenInCluster (net.js:1401:12)
  at GetAddrInfoReqWrap.doListen [as callback] (net.js:1510:7)
  at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:72:10)

tput: No value for $TERM and no -T specified

   ╭───────────────────────────────────────────────────╮
   │                                                   │
   │   ✖ Nuxt Fatal Error                              │
   │                                                   │
   │   Error: listen EADDRNOTAVAIL [domain]:8000   │
   │                                                   │
   ╰───────────────────────────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! iwa-frontend@1.0.0 start: `nuxt start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the iwa-frontend@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/www/vhosts/[domain].org/.npm/_logs/2019-08-07T07_46_00_876Z-debug.log

这是我server.js在根目录中的文件

const express = require('express');
const { Nuxt, Builder } = require('nuxt');

const config = require('./nuxt.config.js');

// Create new express app
const app = express();

// Listen to port 3000 or PORT env if provided
app.listen(process.env.PORT || 8000);

// Enable production mode
config.dev = false;

// Create instance of nuxt
const nuxt = new Nuxt(config);

这是我的nuxt.config.js

import colors from "vuetify/es5/util/colors";

export default {
  mode: "universal",
  /*
   ** Headers of the page
   */
    server: {
    port: 8000, // default: 3000
    host: '[domain-name].org', // default: localhost
  },
  head: {
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      {
        hid: "description",
        name: "description",
        content: process.env.npm_package_description || ""
      }
    ],
    link: [
      { rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
      {
        rel: "stylesheet",
        href:
          "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"
      }
    ]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: "#fff" },
  /*
   ** Global CSS
   */
  css: ["~/assets/main.css"],

  router: {
    middleware: "i18n"
  },
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    "~/plugins/mdi-font.js",
    "~/plugins/i18n.js",
    "~/plugins/axios.js",
    { src: "~/plugins/flag.js", ssr: false }
  ],
  /*
   ** Nuxt.js modules
   */
  modules: [
    "@nuxtjs/vuetify",
    // Doc: https://axios.nuxtjs.org/usage
    "@nuxtjs/axios"
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {},
  /*
   ** vuetify module configuration
   ** https://github.com/nuxt-community/vuetify-module
   */
  vuetify: {
    theme: {
      primary: colors.blue.darken2,
      accent: colors.grey.darken3,
      secondary: colors.amber.darken3,
      info: colors.teal.lighten1,
      warning: colors.amber.base,
      error: colors.deepOrange.accent4,
      success: colors.green.accent3
    }
  },
  /*
   ** Build configuration
   */
  build: {
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {}
  }
};

我应该怎么办?谢谢

4

0 回答 0