Home > Back-end >  Firebase library wouldn't work with '@grpc/grpc-js' in Next.js
Firebase library wouldn't work with '@grpc/grpc-js' in Next.js

Time:12-06

I'm developing the web application in Next.js Firebase. The problem is that the GRPC in Firebase is called incorrectly, so we need to edit the node_modules directly.

It works if I edit the GRPS in node_modules, but this is unsound.

Would you help me fix this issue?

SyntaxError: The requested module '@grpc/grpc-js' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export. For example: import pkg from '@grpc/grpc-js'; const { credentials, loadPackageDefinition, Metadata } = pkg;

  • package.json
...
  "dependencies": {
    "autoprefixer": "^10.4.0",
    "eslint-plugin-react": "^7.27.1",
    "firebase": "^9.6.0",
    "next": "12.0.4",
    "postcss": "^8.4.4",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "tailwindcss": "^2.2.19"
  },
...

CodePudding user response:

upgrade/downgrade version node

  • Related