Next.js with @google-cloud/bigquery : Unexpected error determining execution environment: process.emitWarning is not a function

风流意气都作罢 提交于 2021-01-29 10:01:51

问题


I am trying to run next.js project with @google-cloud/bigquery client library/

I get below error when running the project.

TypeError: Unexpected error determining execution environment: process.emitWarning is not a function

here is my next.config.js

module.exports = {
  webpack: (config, { isServer }) => {
    // Fixes npm packages that depend on `fs` module
    if (!isServer) {
      config.node = {
        ...config.node,
        fs: "empty",
        child_process: "empty",
        net: "empty",
        tls: "empty",
      };
    }

    return config;
  },
  env: {
    GREETING: process.env.GREETING,
  
  },
};

package.json:

{
  "name": "testiot",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@google-cloud/bigquery": "^5.5.0",
    "dotenv": "^8.2.0",
    "fs": "^0.0.1-security",
    "next": "10.0.5",
    "next-images": "^1.7.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "request": "^2.88.2",
    "retry-request": "^4.1.3"
  }
}

GREETING message is able to print but it gives me the error in console.

来源:https://stackoverflow.com/questions/65866071/next-js-with-google-cloud-bigquery-unexpected-error-determining-execution-env

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!