首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不要对Netlify的适当错误做出反应

不要对Netlify的适当错误做出反应
EN

Stack Overflow用户
提问于 2022-08-30 12:15:10
回答 1查看 24关注 0票数 0

我希望在构建2分钟后通过Netlify构建我的react应用程序,我得到了这个错误:部署失败。然后我们无法部署您的站点。查看我们的构建文档,了解有关如何排除生成故障的技巧,或者向我们询问调试建议。

我必须说,这是我第一次部署什么东西。这也是我的第一个反应应用,所以我是纯粹的初学者。请耐心地对待我,并感谢您在下面给我的帮助信息:)

下面是deploy的日志:

代码语言:javascript
复制
1:33:26 PM: Build ready to start
1:33:32 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
1:33:32 PM: build-image tag: v4.10.1
1:33:32 PM: buildbot version: d6cba5c3bdf3b91d18560394ac53604c4ddc280f
1:33:32 PM: Fetching cached dependencies
1:33:32 PM: Failed to fetch cache, continuing with build
1:33:32 PM: Starting to prepare the repo for build
1:33:32 PM: No cached dependencies found. Cloning fresh repo
1:33:32 PM: git clone https://github.com/BlackratQQ/RenegadePragueGym
1:33:33 PM: Preparing Git Reference refs/heads/master
1:33:34 PM: Parsing package.json dependencies
1:33:35 PM: Starting build script
1:33:35 PM: Installing dependencies
1:33:35 PM: Python version set to 2.7
1:33:35 PM: Downloading and installing node v16.17.0...
1:33:36 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...
1:33:36 PM: Computing checksum with sha256sum
1:33:36 PM: Checksums matched!
1:33:38 PM: Now using node v16.17.0 (npm v8.15.0)
1:33:38 PM: Started restoring cached build plugins
1:33:38 PM: Finished restoring cached build plugins
1:33:38 PM: Attempting ruby version 2.7.2, read from environment
1:33:39 PM: Using ruby version 2.7.2
1:33:39 PM: Using PHP version 8.0
1:33:39 PM: No npm workspaces detected
1:33:39 PM: Started restoring cached node modules
1:33:39 PM: Finished restoring cached node modules
1:33:40 PM: Installing NPM modules using NPM version 8.15.0
1:33:40 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:40 PM: npm WARN config location in the cache, and they are managed by
1:33:40 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:40 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:40 PM: npm WARN config location in the cache, and they are managed by
1:33:40 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:45 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
1:33:45 PM: npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
1:33:48 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
1:33:52 PM: added 1467 packages, and audited 1468 packages in 12s
1:33:52 PM: 194 packages are looking for funding
1:33:52 PM:   run `npm fund` for details
1:33:52 PM: 7 high severity vulnerabilities
1:33:52 PM: To address issues that do not require attention, run:
1:33:52 PM:   npm audit fix
1:33:52 PM: To address all issues (including breaking changes), run:
1:33:52 PM:   npm audit fix --force
1:33:52 PM: Run `npm audit` for details.
1:33:52 PM: NPM modules installed
1:33:52 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:52 PM: npm WARN config location in the cache, and they are managed by
1:33:52 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:52 PM: Started restoring cached go cache
1:33:52 PM: Finished restoring cached go cache
1:33:52 PM: Installing Go version 1.17 (requested 1.17)
1:33:56 PM: unset GOOS;
1:33:56 PM: unset GOARCH;
1:33:56 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
1:33:56 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
1:33:56 PM: go version >&2;
1:33:56 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
1:33:56 PM: go version go1.17 linux/amd64
1:33:56 PM: Installing missing commands
1:33:56 PM: Verify run directory
1:33:57 PM: ​
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM:   Netlify Build                                                 
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM: ​
1:33:57 PM: ❯ Version
1:33:57 PM:   @netlify/build 27.16.1
1:33:57 PM: ​
1:33:57 PM: ❯ Flags
1:33:57 PM:   baseRelDir: true
1:33:57 PM:   buildId: 630df5869523b04302ece3cb
1:33:57 PM:   deployId: 630df5869523b04302ece3cd
1:33:57 PM: ​
1:33:57 PM: ❯ Current directory
1:33:57 PM:   /opt/build/repo
1:33:57 PM: ​
1:33:57 PM: ❯ Config file
1:33:57 PM:   No config file was defined: using default values.
1:33:57 PM: ​
1:33:57 PM: ❯ Context
1:33:57 PM:   production
1:33:57 PM: ​
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM:   1. Build command from Netlify app                             
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM: ​
1:33:57 PM: $ npm run build
1:33:58 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:58 PM: npm WARN config location in the cache, and they are managed by
1:33:58 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:58 PM: > metrix@0.1.0 build
1:33:58 PM: > react-scripts build
1:33:59 PM: Creating an optimized production build...
1:34:09 PM: 
1:34:09 PM: Treating warnings as errors because process.env.CI = true.
1:34:09 PM: Most CI servers set it automatically.
1:34:09 PM: 
1:34:09 PM: Failed to compile.
1:34:09 PM: 
1:34:09 PM: [eslint]
1:34:09 PM: src/components/Athletes/Athletes.js
1:34:09 PM:   Line 22:9:  'onHover' is assigned a value but never used  no-unused-vars
1:34:09 PM: src/components/Contact/Contact.js
1:34:09 PM:   Line 11:3:  'SterboholyWrapper' is defined but never used  no-unused-vars
1:34:09 PM:   Line 12:3:  'ModranyWrapper' is defined but never used     no-unused-vars
1:34:09 PM: src/components/GlobalLink/Link.js
1:34:09 PM:   Line 7:15:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
1:34:09 PM: src/components/Gym/Sterboholy/dataCoachesSterboholy.js
1:34:09 PM:   Line 4:10:  'HeadingH2' is defined but never used     no-unused-vars
1:34:09 PM:   Line 10:8:  'dailyFitness' is defined but never used  no-unused-vars
1:34:09 PM:   Line 11:8:  'vaultFitness' is defined but never used  no-unused-vars
1:34:09 PM:   Line 12:8:  'Video' is defined but never used         no-unused-vars
1:34:09 PM: src/components/Header/Sidebar/styledSidebar.js
1:34:09 PM:   Line 3:18:  'LinkRouter' is defined but never used  no-unused-vars
1:34:09 PM:   Line 5:10:  'green' is defined but never used       no-unused-vars
1:34:09 PM: ​
1:34:09 PM: ────────────────────────────────────────────────────────────────
1:34:09 PM:   "build.command" failed                                        
1:34:09 PM: ────────────────────────────────────────────────────────────────
1:34:09 PM: ​
1:34:09 PM:   Error message
1:34:09 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
1:34:09 PM: ​
1:34:09 PM:   Error location
1:34:09 PM:   In Build command from Netlify app:
1:34:09 PM:   npm run build
1:34:09 PM: ​
1:34:09 PM:   Resolved config
1:34:09 PM:   build:
1:34:09 PM:     command: npm run build
1:34:09 PM:     commandOrigin: ui
1:34:09 PM:     publish: /opt/build/repo/build
1:34:09 PM:     publishOrigin: ui
1:34:09 PM: Caching artifacts
1:34:09 PM: Started saving node modules
1:34:09 PM: Finished saving node modules
1:34:09 PM: Started saving build plugins
1:34:09 PM: Finished saving build plugins
1:34:09 PM: Started saving pip cache
1:34:10 PM: Finished saving pip cache
1:34:10 PM: Started saving emacs cask dependencies
1:34:10 PM: Finished saving emacs cask dependencies
1:34:10 PM: Started saving maven dependencies
1:34:10 PM: Finished saving maven dependencies
1:34:10 PM: Started saving boot dependencies
1:34:10 PM: Finished saving boot dependencies
1:34:10 PM: Started saving rust rustup cache
1:34:10 PM: Finished saving rust rustup cache
1:34:10 PM: Started saving go dependencies
1:34:10 PM: Finished saving go dependencies
1:34:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:34:11 PM: Creating deploy upload records
1:34:11 PM: Failing build: Failed to build site
1:34:11 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:34:11 PM: Finished processing build request in 39.340580069s
EN

回答 1

Stack Overflow用户

发布于 2022-08-30 12:20:18

当您有警告并尝试用

代码语言:javascript
复制
process.env.CI = true

在大多数连续集成系统中,这是错误的。如果CI设置为真,webpack将把所有警告视为错误。

你有三个选择

errors

  • Dislable

  • 解决所有警告(最佳解决方案)

  • ,在env变量

中为您的

  • CI构建添加eslint-

  • 标记。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73542304

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档