Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Vercel build failed while deploying with monorepo #679

@anuragkumar19

Description

@anuragkumar19

Hi ! I have encountered a problem while deploying my nuxt app with vercel. The picture below shows the error.
##image

I am using monorepo and my folder structure look like this.
image
image

Nuxt Package.json

{
  "name": "@spectrum/web",
  "version": "1.2.1",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "@nuxtjs/auth-next": "5.0.0-1648802546.c9880dc",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/toast": "^3.3.1",
    "core-js": "^3.19.3",
    "nuxt": "^2.15.8",
    "vue": "^2.6.14",
    "vue-server-renderer": "^2.6.14",
    "vue-template-compiler": "^2.6.14",
    "vuetify": "^2.6.1",
    "webpack": "^4.46.0"
  },
  "devDependencies": {
    "@nuxtjs/vuetify": "^1.12.3"
  }
}

nuxt.config.js :

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

export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    titleTemplate: "%s - Spectrum",
    title: "",
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      { hid: "description", name: "description", content: "Spectrum" },
      { name: "format-detection", content: "telephone=no" },
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/vuetify
    "@nuxtjs/vuetify",
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    "@nuxtjs/axios",
    "@nuxtjs/toast",
    "@nuxtjs/auth-next",
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
    baseURL: `${process.env.SERVER_URL}/api/v1`,
  },

  toast: {
    position: "bottom-right",
    duration: 3000,
  },

  // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
  vuetify: {
    customVariables: ["~/assets/variables.scss"],
    theme: {
      dark: false,
      themes: {
        dark: {
          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,
        },
      },
    },
  },
  auth: {
    cookie: {
      options: {
        maxAge: 60 * 60 * 24 * 365 * 50, // 50 years
      },
    },
    redirect: {
      logout: "/login",
    },
    strategies: {
      local: {
        scheme: "~/schemes/customScheme",
        token: {
          property: "tokens.accessToken",
          maxAge: 60 * 9, // 9 minutes
          global: true,
          type: "Bearer",
        },
        refreshToken: {
          property: "tokens.refreshToken",
          data: "refreshToken",
          maxAge: 60 * 60 * 24 * 30 * 12 * 50, // 50 years
        },
        user: {
          property: "user",
          autoFetch: true,
        },
        endpoints: {
          login: { url: "/auth/login", method: "post" },
          mfaLogin: { url: "/auth/mfa/validate", method: "post" },
          refresh: { url: "/auth/refresh", method: "post" },
          user: { url: "/user/me", method: "get" },
          logout: { url: "/auth/logout", method: "post" },
        },
        // autoLogout: false
      },
    },
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {},
  router: {
    middleware: ["auth"],
  },
};

vecel.json:

{
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {}
    }
  ]
}

Vercel Settings
image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions