我有一个 django 1.10 应用程序,我已经部署到 netlify 但无法构建。我正在使用 django distill 应用程序生成静态文件。我已经将这些推送到 https://github.com/kc1/static1 .
netlify 构建日志有;
1:12:57 PM: $ npm run-script build
1:12:57 PM: npm ERR! code ENOENT
1:12:57 PM: npm ERR! syscall open
1:12:57 PM: npm ERR! path /opt/build/repo/package.json
1:12:57 PM: npm ERR! errno -2
1:12:57 PM: npm ERR! enoent ENOENT: no such file or directory, open '/opt/build/repo/package.json'
1:12:57 PM: npm ERR! enoent This is related to npm not being able to find a file.
1:12:57 PM: npm ERR! enoent
1:12:57 PM: npm ERR! A complete log of this run can be found in:
1:12:57 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-08-05T17_12_57_910Z-debug.log
1:12:57 PM:
1:12:57 PM: ────────────────────────────────────────────────────────────────
1:12:57 PM: "build.command" failed
1:12:57 PM: ────────────────────────────────────────────────────────────────
1:12:57 PM:
1:12:57 PM: Error message
1:12:57 PM:命令失败,退出代码为 254:npm run-script build
正如您在 repo 中看到的那样,我没有 package.json(这来自 python)。我需要创建一个吗?我如何让它工作?
保持构建命令为空。
您只需要在我们必须“构建”某些东西时添加构建命令,因为您已经生成了静态文件,因此您不必再次构建它。
Sumithran 的回答帮助我朝着正确的方向前进。
我之前用
gatsby
写了一个博客然后我切换到hugo
.
在 Netlify 中,我只更改了存储库。我仍在使用
npm run-script build
作为我的构建命令,这导致了这个错误。
我最初尝试清空“构建命令”,但这导致了不同的错误。
看了Hugo和Netlify的视频,得知只需要在build命令中传递
hugo
即可
tldr 'build command' 的正确值取决于您使用的工具。