Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Service worker is installed but it does not allow me to install the app with @nuxtjs/pwa #654

Open
GuasaPlay opened this issue Feb 16, 2022 · 1 comment

Comments

@GuasaPlay
Copy link

GuasaPlay commented Feb 16, 2022

Hello, this is the first time that I am deploying a nuxt app in Vercel and I have found a problem related to the PWA.

Make the recommended configuration for Service Worker to work as you can see below:

vercel.json

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": [
          "package.json"
        ]
      }
    }
  ],
  "routes": [
    {
      "src": "/sw.js",
      "continue": true,
      "headers": {
        "Cache-Control": "public, max-age=0, must-revalidate",
        "Service-Worker-Allowed": "/"
      }
    }
  ]
}

However, it does not show me the button to install the application from the web and from mobile.

image

Checking the service worker from the browser's developer tools, it can be seen that it is added correctly.

image

nuxt.config.js file

...
  pwa: {
    manifest: {
      lang: 'es',
    },
  },
...

package.json file

{
  "name": "educarty-frontend",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
    "lint:prettier": "prettier --check .",
    "lint": "yarn lint:js && yarn lint:prettier",
    "lintfix": "prettier --write --list-different . && yarn lint:js --fix"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/pwa": "^3.3.5",
    "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",
    "webpack": "^4.46.0"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.16.3",
    "@nuxt/postcss8": "^1.1.3",
    "@nuxtjs/eslint-config": "^8.0.0",
    "@nuxtjs/eslint-module": "^3.0.2",
    "@nuxtjs/vercel-builder": "^0.22.1",
    "autoprefixer": "^10.4.2",
    "eslint": "^8.4.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-nuxt": "^3.1.0",
    "eslint-plugin-vue": "^8.2.0",
    "postcss": "^8.4.6",
    "prettier": "^2.5.1",
    "tailwindcss": "^3.0.22"
  }
}

I really don't know what the problem is everything is in place, it would be very helpful if someone can help me solve this problem

@GuasaPlay GuasaPlay changed the title The Service workeR is installed but it does not allow me to install the app with @nuxtjs/pwa The Service worker is installed but it does not allow me to install the app with @nuxtjs/pwa Feb 16, 2022
@danielroe
Copy link
Member

Would you provide a reproduction please? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants