Vercel部署时出现模糊错误(退出代码为1)



所以通常Vercel给我体面的错误信息,但这一个似乎没有细节。

"失败,退出代码为1"。

作为上下文,我只是用基本的NextJS模板开始这个项目,做了一些修改,这是我的第一次部署。

失败了一次,我认为这是因为NextJS默认情况下有严格的类型检查,所以我修改了next.config.js文件如下(按这里):

module.exports = {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
};

但仍然失败。以下是完整的日志:

10:23:27.575    Cloning github.com/lawderp/physical (Branch: main, Commit: 8f97554)
10:23:28.589    Cloning completed: 1.014s
10:23:28.614    Analyzing source code...
10:23:29.739    Installing build runtime...
10:23:31.612    Build runtime installed: 1.873s
10:23:34.043    Looking up build cache...
10:23:34.164    Build cache found. Downloading...
10:23:35.100    Build cache downloaded [21.48 MB]: 936.007ms
10:23:36.250    Installing dependencies...
10:23:36.489    yarn install v1.22.11
10:23:36.547    [1/4] Resolving packages...
10:23:36.734    success Already up-to-date.
10:23:36.743    Done in 0.26s.
10:23:36.754    Detected Next.js version: 11.1.2
10:23:36.755    Running "yarn run build"
10:23:37.021    yarn run v1.22.11
10:23:37.047    $ next build
10:23:37.820    info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
10:23:37.976    info  - Skipping validation of types...
10:23:40.439    error Command failed with exit code 1.
10:23:40.439    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:23:40.456    Error: Command "yarn run build" exited with 1

仍然不确定问题是什么,但最终找到了如何解决这个问题-通过在next.config.js中添加以下内容来忽略ESLint:

eslint: {
ignoreDuringBuilds: true,
},

(我不建议这样做,但这是一个快速的低风险实验)

在进行eslint更改后,我收到了相同的模糊消息。本地检查和部署成功,但是部署到vercel失败,就像您的一样。

虽然我的.eslint.json中的"ignoreDuringBuilds": "true"确实解决了这个问题,但我能够回滚每个eslint更改,并发现我的"linebreak-style": ["error", "windows"]是潜在的问题。

它通过了本地检查,但在全局部署中失败。我已经修复了我的换行符,现在所有的工作都很好,而不必在构建期间忽略。

相关内容

最新更新