Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在nuxt+上运行应用程序时指定端口;ts+;pm2?_Javascript_Typescript_Vue.js_Nuxt.js_Pm2 - Fatal编程技术网

Javascript 如何在nuxt+上运行应用程序时指定端口;ts+;pm2?

Javascript 如何在nuxt+上运行应用程序时指定端口;ts+;pm2?,javascript,typescript,vue.js,nuxt.js,pm2,Javascript,Typescript,Vue.js,Nuxt.js,Pm2,我有一个通过pm2运行的nuxt+ts应用程序。在我决定将numxt.config.js改为numxt.config.ts之前,一切都很顺利。应用程序开始在端口3000上运行,尽管在nuxt.config.ts配置中指定了端口4000 这是我在package.json中的脚本: "scripts": { "dev": "nuxt-ts", "build": "nuxt

我有一个通过pm2运行的nuxt+ts应用程序。在我决定将numxt.config.js改为numxt.config.ts之前,一切都很顺利。应用程序开始在端口3000上运行,尽管在nuxt.config.ts配置中指定了端口4000

这是我在package.json中的脚本:

    "scripts": {
        "dev": "nuxt-ts",
        "build": "nuxt-ts build",
        "start": "npm run build && pm2 start pm2.config.js",
        "stop": "pm2 stop pm2.config.js",
        "generate": "nuxt-ts generate",
        "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
        "lint": "npm run lint:js",
        "test": "jest"
    },
这是我的numxt.config.ts:

export default {
    /*
    ** Nuxt rendering mode
    */
    mode: 'universal',
    /*
    ** Nuxt target
    */
    target: 'server',
    env: {
    },
    /*
    ** Global CSS
    */
    css: [
        '~/assets/css/fonts.css',
    ],
    components: true,
    /*
    ** Nuxt.js dev-modules
    */
    buildModules: [
        '@nuxt/typescript-build',
        'nuxt-typed-vuex',
    ],
    /*
    ** Nuxt.js modules
    */
    modules: [
        'nuxt-clipboard2',
        '@nuxtjs/axios',
        '@nuxtjs/toast',
        '@nuxtjs/moment',
        '@nuxtjs/sitemap',
        'vue-social-sharing/nuxt',
        'nuxt-i18n',
    ],
    router: {
        linkExactActiveClass: 'link-exact-active',
    },
    i18n: {
        locales: ['en'],
        defaultLocale: 'en',
        vueI18n: {
            fallbackLocale: 'en',
            messages,
        },
    },
    /*
    ** Axios module configuration
    */
    axios: {},
    /*
    ** Auth module configuration
    */
    auth: {},
    /*
    ** Build configuration
    */
    build: {
        transpile: [
            /typed-vuex/,
        ],
    },
    server: {
        port: process.env.BASE_PORT || 4000,
        host: 'localhost',
    },
};
这是我的pm2.config.js:

module.exports = {
    apps: [
        {
            name: 'app',
            exec_mode: 'cluster',
            instances: 1,
            script: './node_modules/nuxt/bin/nuxt.js',
            env: {
                NODE_ENV: 'development',
            },
            env_production: {
                NODE_ENV: 'production',
            },
            args: 'start',
        },
    ],
};