question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fix: Error You need to add `@nuxtjs/composition-api` when using serverMiddleware

See original GitHub issue

🐛 The bug When register serverMiddleware and using "@nuxtjs/composition-api": "^0.20.0" But I have added @nuxtjs/composition-api in nuxt.config.ts

error You need to add @nuxtjs/composition-api to your buildModules in order to use it. ServerMiddleware Error: You need to add @nuxtjs/composition-api to your buildModules in order to use it.

package.json

{
  "name": "myrepo",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "build": "nuxt-ts build",
    "dev": "npm run clean && nuxt-ts",
    "export": "nuxt-ts export",
    "eslint": "eslint --ext .js,.vue --ignore-path .gitignore .",
    "stylelint": "stylelint **/*.{vue,css} --ignore-path .gitignore",
    "start": "nuxt-ts start",
    "serve": "nuxt-ts serve",
    "test": "jest",
    "clean": "rm -rf node_modules/.cache/hard-source/"
  },
  "dependencies": {
    "@fortawesome/free-regular-svg-icons": "^5.14.0",
    "@google-cloud/bigquery": "^5.5.0",
    "@nuxt/typescript-runtime": "^0.4.10",
    "@nuxtjs/composition-api": "0.20.0",
    "@nuxtjs/dayjs": "^1.2.0",
    "@nuxtjs/gtm": "^2.4.0",
    "@sendgrid/mail": "^7.4.2",
    "@stripe/stripe-js": "^1.11.0",
    "@types/file-saver": "^2.0.1",
    "@types/js-cookie": "^2.2.6",
    "@types/jwt-decode": "^2.2.1",
    "axios": "^0.21.1",
    "chart.js": "^2.9.3",
    "cookieparser": "^0.1.0",
    "dayjs": "^1.8.29",
    "file-saver": "^2.0.2",
    "firebase": "^7.16.0",
    "firebase-admin": "^9.3.0",
    "js-cookie": "^2.2.1",
    "jwt-decode": "^3.0.0",
    "nuxt": "^2.15.3",
    "querystringify": "^2.2.0",
    "ress": "^2.0.4",
    "vee-validate": "^3.4.3",
    "vue-chartjs": "^3.5.1",
    "vue-window-size": "^1.0.3",
    "vue2-datepicker": "^3.6.1"
  },
  "devDependencies": {
    "@fortawesome/free-brands-svg-icons": "^5.14.0",
    "@fortawesome/free-solid-svg-icons": "^5.14.0",
    "@nuxt/types": "^2.13.3",
    "@nuxt/typescript-build": "^1.0.3",
    "@nuxtjs/axios": "^5.12.2",
    "@nuxtjs/eslint-config": "^3.0.0",
    "@nuxtjs/eslint-config-typescript": "^2.0.0",
    "@nuxtjs/eslint-module": "^2.0.0",
    "@nuxtjs/fontawesome": "^1.1.2",
    "@nuxtjs/proxy": "^2.1.0",
    "@nuxtjs/style-resources": "^1.0.0",
    "@nuxtjs/stylelint-module": "^4.0.0",
    "@nuxtjs/vercel-builder": "^0.17.4",
    "@types/querystringify": "^2.0.0",
    "@types/url-parse": "^1.4.3",
    "@types/vue2-datepicker": "^3.3.0",
    "@vue/test-utils": "^1.0.3",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.0.1",
    "eslint": "^7.2.0",
    "eslint-plugin-nuxt": "^1.0.0",
    "jest": "^26.0.1",
    "node-sass": "^5.0.0",
    "nuxt-property-decorator": "^2.8.8",
    "sass": "^1.32.6",
    "sass-loader": "^10.1.1",
    "stylelint": "^13.6.1",
    "stylelint-config-recess-order": "^2.0.4",
    "stylelint-config-standard": "^20.0.0",
    "stylelint-scss": "^3.18.0",
    "ts-jest": "^26.1.0",
    "vue-jest": "^3.0.4"
  }
}

Try Using "nuxt": "^2.15.3" , but it is unsolved.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danielroecommented, Mar 23, 2021

@HirokiOmote I’ve released a new version that should add fallback support for versions of Node without support for package.json exports. If you’re still experiencing an issue, do create a reproduction and I’ll happily take a look.

0reactions
HirokiOmotecommented, Mar 24, 2021

@danielroe OK. I will trying new version 😄 Thank you for all dealing with my problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error ServerMiddleware should expose a handle nuxt
Yo should export you server middleware . At the bottom add : // export the server middleware module.exports = { path: '/api', handler:...
Read more >
cannot find serverMiddleware module error while building #257
I have a following server middleware written in TypeScript. ... When I execute yarn run nuxt storybook , it throws error.
Read more >
The serverMiddleware Property - Nuxt
Nuxt internally creates a connect instance that you can add your own custom middleware to. This allows us to register additional routes (typically...
Read more >
@nuxtjs/composition-api | Yarn - Package Manager
Composition API hooks for Nuxt. @nuxtjs/composition-api provides a way to use the Vue 3 Composition API in with Nuxt-specific features.
Read more >
How to work with Server Middleware in Nuxt.js - YouTube
When you are know more about Middleware in Nuxt.js you will discovered you sometimes need server middleware in Nuxt.js, in this Video I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found