簡體   English   中英

如何解決以 1 個錯誤退出的命令“yarn run build”!?

[英]How to solve Command "yarn run build" exited with 1 Error!?

我之前已經創建了我的 vercel 應用程序,但是當我嘗試使用vercel --prod進行更新時,我得到了

Error! Command "yarn run build" exited with 1
Error! Check your logs...

當我檢查我的日志時,我得到了它,但我不知道如何處理它們,因為例如我有其他空變量,但這不是問題。

16:02:07.366    Retrieving list of deployment files...
16:02:08.837    Downloading 25 deployment files...
16:02:09.301    Analyzing source code...
16:02:10.840    Installing build runtime...
16:02:13.806    Build runtime installed: 2.965s
16:02:17.056    Looking up build cache...
16:02:19.686    Build cache downloaded [24.72 MB]: 2226.563ms
16:02:20.981    Detected package.json
16:02:20.982    Installing dependencies...
16:02:21.305    yarn install v1.22.17
16:02:21.420    [1/4] Resolving packages...
16:02:22.236    success Already up-to-date.
16:02:22.241    Done in 0.94s.
16:02:22.515    Running "yarn run build"
16:02:22.752    yarn run v1.22.17
16:02:22.793    $ react-scripts build
16:02:24.503    Creating an optimized production build...
16:02:25.419    Browserslist: caniuse-lite is outdated. Please run:
16:02:25.419    npx browserslist@latest --update-db
16:02:25.420    
16:02:25.420    Why you should do it regularly:
16:02:25.420    https://github.com/browserslist/browserslist#browsers-data-updating
16:02:29.686    
16:02:29.686    Treating warnings as errors because process.env.CI = true.
16:02:29.687    Most CI servers set it automatically.
16:02:29.687    
16:02:29.687    Failed to compile.
16:02:29.687    
16:02:29.688    src/App.js
16:02:29.688    Line 7:20: 'setProducts' is assigned a value but never used no-unused-vars
16:02:29.688    
16:02:29.688    src/components/CartProduct/index.jsx
16:02:29.688    Line 7:17: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
16:02:29.688    
16:02:29.689    src/components/Product/index.jsx
16:02:29.691    Line 7:13: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
16:02:29.691    
16:02:29.691    
16:02:29.714    error Command failed with exit code 1.
16:02:29.714    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
16:02:29.732    Error: Command "yarn run build" exited with 1

在你的 eslint 配置文件中,關閉no-unused-var

"rules": {
       .....

      "no-unused-vars": "off"

       .....
    }

並為帶有或不帶有文本的圖像標簽添加 Alt:

<img src="[image url]" alt="" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM