0

我正在使用一个反应应用程序,我正在使用下一个 js 和 express,我现在选择 zeit for servless 但是当我部署这个面临的错误 错误:没有构建无服务器页面

next.config.js

const configuration = withTypescript(
    withLess({,
     target: process.env.NODE_ENV === "development" ? "server" : "serverless",
      cssModules: true,
      lessLoaderOptions: {
        javascriptEnabled: true,
        modifyVars: themeVariables // make your antd custom effective
      },

      exportPathMap: async function(defaultPathMap) {
        return {
          "/": { page: "/index" },
        };
      },
      webpack: config => {
        config.plugins = config.plugins || [];
        config.plugins = [
          ...config.plugins,

          // Read the .env file
          new Dotenv({
            path: path.join(__dirname, "../.env"),
            systemvars: true
          })
        ];

        return config;
      },

    })
);

module.exports = configuration;

使用下一个版本:“@types/next”:“^8.0.0”,

现在.json

{
  "version": 2,
  "name": "web",
  "builds": [
    { "src": "package.json", "use": "@now/next" }
  ],

}

内包json

 "scripts": {
    "dev": "next src",
    "build": "next build src",
    "start": "next run build && next start src",
    "export": "npm run build && next export src -o ./out",
    "now-build": "next build src","
  },

从zeit Now日志中获取错误

preparing lambda files...
2019-04-19T17:24:04.955Z  Error: No serverless pages were built. https://err.sh/zeit/now-builders/now-next-no-serverless-pages-built
                              at Object.exports.build (/tmp/utils/build-module/node_modules/@now/next/index.js:305:13)
                              at <anonymous>

请在这里帮我弄清楚。谢谢。

4

0 回答 0