由于退出代码 1,为什么我无法通过 Netlify 部署 React 应用程序?
Why can't I deploy React app through Netlify due to exit code 1?
所以我正在尝试通过 Netlify 部署我的 React 项目。我已经搜索了我的错误的解决方案,但找不到解决问题的方法。
下面是日志。
(...)
12:21:05 PM: $ npm run build
12:21:06 PM: > synergy_react@0.1.0 build /opt/build/repo/synergy_react
12:21:06 PM: > react-scripts build
12:21:07 PM: Creating an optimized production build...
(...)
12:21:26 PM: Failed to compile.
(...)
12:21:26 PM: npm ERR! code ELIFECYCLE
12:21:26 PM: npm ERR! errno 1
12:21:26 PM: npm ERR! synergy_react@0.1.0 build: `react-scripts build`
12:21:26 PM: npm ERR! Exit status 1
12:21:26 PM: npm ERR!
12:21:26 PM: npm ERR! Failed at the synergy_react@0.1.0 build script.
12:21:26 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
12:21:26 PM: npm ERR! A complete log of this run can be found in:
12:21:26 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-03-06T03_21_26_431Z-debug.log
12:21:26 PM:
12:21:26 PM: ────────────────────────────────────────────────────────────────
12:21:26 PM: "build.command" failed
12:21:26 PM: ────────────────────────────────────────────────────────────────
12:21:26 PM:
12:21:26 PM: Error message
12:21:26 PM: Command failed with exit code 1: npm run build
12:21:26 PM:
12:21:26 PM: Error location
12:21:26 PM: In Build command from Netlify app:
12:21:26 PM: npm run build
12:21:26 PM:
12:21:26 PM: Resolved config
12:21:26 PM: build:
12:21:26 PM: base: /opt/build/repo/synergy_react
12:21:26 PM: command: npm run build
12:21:26 PM: commandOrigin: ui
12:21:26 PM: publish: /opt/build/repo/synergy_react/build
另一个奇怪的部分是我也收到 Failed to compile
错误,但它在我的本地服务器上运行得很好。
另外,我也试过 CI=npm run build
,但没用 :(
有什么建议吗?谢谢
您需要在 = 之后有一个 space,而不是在 CI= npm run build
之前
所以我正在尝试通过 Netlify 部署我的 React 项目。我已经搜索了我的错误的解决方案,但找不到解决问题的方法。
下面是日志。
(...)
12:21:05 PM: $ npm run build
12:21:06 PM: > synergy_react@0.1.0 build /opt/build/repo/synergy_react
12:21:06 PM: > react-scripts build
12:21:07 PM: Creating an optimized production build...
(...)
12:21:26 PM: Failed to compile.
(...)
12:21:26 PM: npm ERR! code ELIFECYCLE
12:21:26 PM: npm ERR! errno 1
12:21:26 PM: npm ERR! synergy_react@0.1.0 build: `react-scripts build`
12:21:26 PM: npm ERR! Exit status 1
12:21:26 PM: npm ERR!
12:21:26 PM: npm ERR! Failed at the synergy_react@0.1.0 build script.
12:21:26 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
12:21:26 PM: npm ERR! A complete log of this run can be found in:
12:21:26 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-03-06T03_21_26_431Z-debug.log
12:21:26 PM:
12:21:26 PM: ────────────────────────────────────────────────────────────────
12:21:26 PM: "build.command" failed
12:21:26 PM: ────────────────────────────────────────────────────────────────
12:21:26 PM:
12:21:26 PM: Error message
12:21:26 PM: Command failed with exit code 1: npm run build
12:21:26 PM:
12:21:26 PM: Error location
12:21:26 PM: In Build command from Netlify app:
12:21:26 PM: npm run build
12:21:26 PM:
12:21:26 PM: Resolved config
12:21:26 PM: build:
12:21:26 PM: base: /opt/build/repo/synergy_react
12:21:26 PM: command: npm run build
12:21:26 PM: commandOrigin: ui
12:21:26 PM: publish: /opt/build/repo/synergy_react/build
另一个奇怪的部分是我也收到 Failed to compile
错误,但它在我的本地服务器上运行得很好。
另外,我也试过 CI=npm run build
,但没用 :(
有什么建议吗?谢谢
您需要在 = 之后有一个 space,而不是在 CI= npm run build