Code Monkey home page Code Monkey logo

Comments (6)

posva avatar posva commented on August 15, 2024

Can you provide a boiled down repro using nuxt-composition-api? https://github.com/nuxt-community/composition-api

from pinia.

christianechevarria avatar christianechevarria commented on August 15, 2024

Not sure if it's related to the Nuxt Composition API updates @spetex mentioned, but I'm experiencing the same issue as in #179, I'm currently using the latest Nuxt version and I'm wondering if this is the root of the issue

Everything builds fine but then the Cannot read property 'req' is returned when trying to access any page. In case it's useful, this is what my package.json and nuxt.config.js look like respectively:

// package.json
{
  "name": "nuxt",
  "version": "1.0.0",
  "description": "A description",
  "author": "Christian George Echevarria-Reina",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt-ts build",
    "old_start": "nuxt-ts start",
    "start": "nuxt-ts",
    "export": "nuxt-ts export",
    "serve": "nuxt-ts serve",
    "generate": "nuxt generate",
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
    "test": "jest"
  },
  "dependencies": {
    "@nuxtjs/apollo": "^4.0.1-rc.1",
    "@nuxtjs/dotenv": "^1.4.0",
    "@nuxtjs/pwa": "^3.0.0-0",
    "@tailwindcss/ui": "^0.3.0",
    "apollo-cache-inmemory": "^1.6.6",
    "body-parser": "^1.19.0",
    "express": "^4.17.1",
    "graphql-tag": "^2.10.3",
    "nuxt": "latest",
    "nuxt-composition-api": "^0.10.6",
    "pinia": "0.0.7",
    "tailwindcss": "^1.4.6"
  },
  "devDependencies": {
    "@babel/runtime-corejs3": "^7.10.1",
    "@nuxt/types": "^2.13.3",
    "@nuxt/typescript-build": "^2.0.0",
    "@nuxtjs/eslint-config": "latest",
    "@nuxtjs/eslint-module": "latest",
    "@nuxtjs/tailwindcss": "~2.0.0",
    "@vue/test-utils": "latest",
    "babel-eslint": "latest",
    "babel-jest": "latest",
    "core-js": "^3.6.5",
    "eslint": "latest",
    "eslint-config-prettier": "latest",
    "eslint-plugin-nuxt": "latest",
    "eslint-plugin-prettier": "latest",
    "jest": "latest",
    "prettier": "latest",
    "vue-jest": "latest"
  }
}

and

// nuxt.config.js

export default {
  mode: 'universal',
  /*
   ** Headers of the page
   */
  head: {
    title: process.env.npm_package_name || '',
    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://rsms.me/inter/inter.css' },
    ],
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: '#fff' },
  /*
   ** Global CSS
   */
  css: [],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: ['~plugins/filters.js'],
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [
    // Doc: https://github.com/nuxt-community/eslint-module
    '@nuxtjs/eslint-module',
    // Doc: https://github.com/nuxt-community/nuxt-tailwindcss
    '@nuxtjs/tailwindcss',
    '@nuxt/typescript-build',
    'pinia/nuxt',
    'nuxt-composition-api',
  ],
  /*
   ** Nuxt.js modules
   */
  modules: [
    '@nuxtjs/pwa',
    // Doc: https://github.com/nuxt-community/dotenv-module
    '@nuxtjs/dotenv',
    '@nuxtjs/apollo',
  ],
  // Give apollo module options
  apollo: {
    cookieAttributes: {
      expires: 7, // optional, default: 7 (days)
    },
    includeNodeModules: true, // optional, default: false (this includes graphql-tag for node_modules folder)
    authenticationType: 'Bearer', // optional, default: 'Bearer'
    // optional
    errorHandler: '~/plugins/apollo-error-handler.js',
    // required
    clientConfigs: {
      default: '~/apollo/clientConfig.js',
    },
  },
  serverMiddleware: ['~/api/index'],
  /*
   ** Build configuration
   */
  build: {
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {},

    babel: {
      configFile: './babel.config.js',
    },
  },
}

I'm going to try rolling back Nuxt to see if it would work in versions lower than 2.12.x and report back the results

from pinia.

christianechevarria avatar christianechevarria commented on August 15, 2024

Update: tried rolling back to 2.12.2 and fixed this particular issue -- although I had another issue where Nuxt would just refresh non-stop, can't say with certainty that it was related to this

from pinia.

eugenioclrc avatar eugenioclrc commented on August 15, 2024

Could you post a woring demo with pinia an nuxt?

from pinia.

posva avatar posva commented on August 15, 2024

Closing due to inactivity. Please open a new issue with a reference to this one if you can follow up with more information.

from pinia.

MartinMalinda avatar MartinMalinda commented on August 15, 2024

This seems to be another occurence of #161. Previous check is not enough because at some point context.nuxtState started existing in spa mode as well.

from pinia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.