【问题标题】:I'm having problems to deploy front end app in netlify or vercel我在 netlify 或 vercel 中部署前端应用程序时遇到问题
【发布时间】:2021-04-29 17:16:47
【问题描述】:

我正在尝试在 Netlify 中部署一个前端反应应用程序,但我收到一个错误。看:


8:10:39 AM: Failed to compile.
8:10:39 AM: 
8:10:39 AM: src/App.tsx                                                             no-unused-vars
8:10:39 AM:   Line 31:21:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
8:10:39 AM:   Line 46:25:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
8:10:39 AM: src/components/Countdown.jsx
8:10:39 AM: src/components/LevelUpModal.jsx
8:10:39 AM:   Line 16:17:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
8:10:39 AM: src/contexts/ChallengesContext.jsx
8:10:39 AM:   Line 3:9:  'reactLocalStorage' is defined but never used  no-unused-vars
8:10:39 AM: src/contexts/CountDownContext.jsx                                                                                  eqeqeq
8:10:39 AM:   Line 40:8:   React Hook useEffect has a missing dependency: 'startNewChallenge'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
8:10:39 AM: npm ERR! code ELIFECYCLE
8:10:39 AM: npm ERR! errno 1
8:10:39 AM: npm ERR! moveittypescript@0.1.0 build: `react-scripts build`
8:10:39 AM: npm ERR! Exit status 1
8:10:39 AM: npm ERR!
8:10:39 AM: npm ERR! Failed at the moveittypescript@0.1.0 build script.
8:10:39 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
8:10:39 AM: npm ERR! A complete log of this run can be found in:
8:10:39 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-03-01T11_10_39_060Z-debug.log
8:10:39 AM: ​
8:10:39 AM: ────────────────────────────────────────────────────────────────
8:10:39 AM:   "build.command" failed                                        
8:10:39 AM: ────────────────────────────────────────────────────────────────
8:10:39 AM: ​
8:10:39 AM:   Error message
8:10:39 AM:   Command failed with exit code 1: npm run build
8:10:39 AM: ​
8:10:39 AM:   Error location
8:10:39 AM:   In Build command from Netlify app:
8:10:39 AM:   npm run build
8:10:39 AM: ​
8:10:39 AM:   Resolved config
8:10:39 AM:   build:
8:10:39 AM:     command: npm run build
8:10:39 AM:     commandOrigin: ui
8:10:39 AM:     publish: /opt/build/repo/build

我已经尝试在 Vercel 中部署,但我收到了同样的错误。警告可能是部署问题吗?

【问题讨论】:

  • 部署问题*
  • 在vercel中,但是...*
  • 你知道你可以edit your question吗?评论用于询问问题或回复其他 cmets。但是感谢您纠正这些错误!

标签: reactjs netlify


【解决方案1】:
  1. img 元素必须有一个 alt 属性:使用图像的 alt 属性 这是反应所必需的。
  2. 'reactLocalStorage' 已定义但从未使用只是一个警告 no 问题。
  3. React Hook useEffect 缺少依赖项:检查其语法或 检查导入。

【讨论】:

    猜你喜欢
    • 2022-11-03
    • 2019-01-02
    • 1970-01-01
    • 2022-01-24
    • 2020-07-14
    • 2019-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多