nuxt / bridge

🌉 Experience Nuxt 3 features on existing Nuxt 2 projects
MIT License
271 stars 29 forks source link

Error after setting up nuxt bridge: Cannot find module '.nuxt/views/document.template.mjs' #367

Closed SylvainBigonneau closed 2 years ago

SylvainBigonneau commented 2 years ago

Environment


Reproduction

Could not reproduce

Describe the bug

I followed to the mark the migration guide for setting up bridge on an existing nuxt 2 app, and managed to launch my app, but it crashes on load with the following error:

✔ TWA generated successfully
✔ Nitro built in 350 ms
ℹ Waiting for file changes
Nuxt CLI v3.0.0-rc.3-27578655.a802b87

  > Local:    http://localhost:3000/ 
  > Network:  http://172.21.0.4:3000/

 ERROR  [worker reload] [worker init] Cannot find module '/home/node/app/.nuxt/views/document.template.mjs' imported from /home/node/app/.nuxt/dev/index.mjs

  at new NodeError (node:internal/errors:372:5)
  at finalizeResolution (node:internal/modules/esm/resolve:437:11)
  at moduleResolve (node:internal/modules/esm/resolve:1009:10)
  at defaultResolve (node:internal/modules/esm/resolve:1218:11)
  at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
  at link (node:internal/modules/esm/module_job:78:36)

And indeed, that "document.template.mjs" file does not exist in the ".nuxt/views". There are only 2 files in there: "app.template.html" and "error.html".

Sorry, I could not provide any suitable reproduction on the given websites!

Additional context

Here is my package.json:

{
  "name": "web-app",
  "version": "1.0.0",
  "private": true,
  "engines": {
    "node": "^16",
    "npm": "^6"
  },
  "config": {
    "nuxt": {
      "host": "0.0.0.0"
    }
  },
  "babel": {
    "presets": [
      "env"
    ],
    "plugins": [
      [
        "module-resolver",
        {
          "alias": {
            "@": "./",
            "~": "./",
            "gql": "./apollo/graphql"
          }
        }
      ]
    ]
  },
  "scripts": {
    "dev": "nuxi dev",
    "build": "nuxi build",
    "start": "NODE_ENV=production nuxi start",
  },
  "dependencies": {
    "@absinthe/socket-apollo-link": "^0.2.1",
    "@capacitor-community/apple-sign-in": "^1.0.1",
    "@capacitor-community/facebook-login": "^3.1.1",
    "@capacitor/core": "^3.0.1",
    "@capacitor/storage": "^1.0.1",
    "@mathieustan/vue-intercom": "^0.0.7",
    "@nuxtjs/apollo": "^4.0.1-rc.5",
    "@nuxtjs/auth-next": "5.0.0-1643791578.532b3d6",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/pwa": "^3.3.5",
    "apollo-cache-inmemory": "^1.2.5",
    "apollo-link-error": "^1.1.11",
    "dotenv": "^9.0.2",
    "flickity": "^2.1.2",
    "graphql-tag": "^2.9.2",
    "intersection-observer": "^0.12.0",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.25",
    "nuxt-edge": "latest",
    "nuxt-i18n": "^6.27.0",
    "phoenix": "^1.5.9",
    "redirect-ssl": "^2.0.1",
    "rollbar": "^2.24.0",
    "rollbar-sourcemap-webpack-plugin": "^3.3.0",
    "smooth-scroll-to": "^0.2.0",
    "vue": "^2.6.6",
    "vue-croppa": "^1.3.8",
    "vue-quill-editor": "^3.0.6",
    "vue-server-renderer": "^2.6.6",
    "vue-template-compiler": "^2.6.6",
    "vuelidate": "^0.7.4",
    "websocket": "^1.0.25",
    "workerize": "^0.1.7"
  },
  "devDependencies": {
    "@capacitor/cli": "^3.0.1",
    "@capacitor/ios": "^3.0.1",
    "@nuxt/bridge": "npm:@nuxt/bridge-edge",
    "@nuxtjs/google-fonts": "^1.3.0",
    "@playlyfe/gql": "^2.6.1",
    "@vue/server-test-utils": "^1.0.0-beta.27",
    "@vue/test-utils": "^1.0.0-beta.27",
    "ava": "^3.15.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "babel-plugin-import-graphql": "^2.6.2",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-polyfill": "^6.26.0",
    "capacitor-plugin-ios-swipe-back": "https://github.com/SylvainBigonneau/capacitor-plugin-ios-swipe-back",
    "devcert": "^1.0.0",
    "eslint": "^7.26.0",
    "eslint-config-standard": "^16.0.2",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-html": "^6.1.2",
    "eslint-plugin-import": "^2.13.0",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-promise": "^5.1.0",
    "eslint-plugin-standard": "^5.0.0",
    "eslint-plugin-vue": "^7.9.0",
    "get-graphql-schema": "^2.1.2",
    "js-yaml": "^4.1.0",
    "jsdom": "^16.5.3",
    "jsdom-global": "^3.0.2",
    "lodash": "4.17.21",
    "node-sass": "^6.0.1",
    "npm": "^7.13.0",
    "nuxt-compress": "^5.0.0",
    "nuxt-twa-module": "^1.3.1",
    "nyc": "^15.1.0",
    "require-extension-hooks": "^0.3.3",
    "require-extension-hooks-babel": "^1.0.0",
    "require-extension-hooks-vue": "^3.0.0",
    "sass-loader": "^10.1.1",
    "stylelint": "^13.13.1",
    "stylelint-config-standard": "^22.0.0",
    "vue-youtube-embed": "^2.2.1"
  }
}

I run the app using yarn dev

Logs

No response

SylvainBigonneau commented 2 years ago

Oh after being transferred to the correct repo I might be seeing that there is already an open issue (#337 ) covering my problem. Will close for now and reopen if needed. Sorry that I had not checked this repo!