首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在netlify中部署我的项目,但"build.command“未能修复

在netlify中部署我的项目,但"build.command“未能修复
EN

Stack Overflow用户
提问于 2022-03-16 09:25:11
回答 1查看 1.8K关注 0票数 -4
代码语言:javascript
复制
2:47:42 PM: Build ready to start
2:47:44 PM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)
2:47:44 PM: build-image tag: v4.5.3
2:47:44 PM: buildbot version: 7eafb394e33f42f945c880ce4ac17c149867813a
2:47:44 PM: Building without cache
2:47:44 PM: Starting to prepare the repo for build
2:47:45 PM: No cached dependencies found. Cloning fresh repo
2:47:45 PM: git clone https://github.com/BhautikInfyOm/InfySocial-App
2:47:47 PM: Preparing Git Reference refs/heads/main
2:47:49 PM: Parsing package.json dependencies
2:47:50 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'frontend/build' versus 'build' in the Netlify UI
2:47:50 PM: Starting build script
2:47:50 PM: Installing dependencies
2:47:50 PM: Python version set to 2.7
2:47:51 PM: Downloading and installing node v16.14.1...
2:47:51 PM: Downloading https://nodejs.org/dist/v16.14.1/node-v16.14.1-linux-x64.tar.xz...
2:47:52 PM: Computing checksum with sha256sum
2:47:52 PM: Checksums matched!
2:47:57 PM: Now using node v16.14.1 (npm v8.5.0)
2:47:57 PM: Started restoring cached build plugins
2:47:57 PM: Finished restoring cached build plugins
2:47:57 PM: Attempting ruby version 2.7.2, read from environment
2:47:58 PM: Using ruby version 2.7.2
2:47:58 PM: Using PHP version 8.0
2:47:58 PM: Started restoring cached node modules
2:47:58 PM: Finished restoring cached node modules
2:47:58 PM: Installing NPM modules using NPM version 8.5.0
2:48:00 PM: npm WARN EBADENGINE Unsupported engine {
2:48:00 PM: npm WARN EBADENGINE   package: 'react-loader-spinner@6.0.0-0',
2:48:00 PM: npm WARN EBADENGINE   required: { npm: 'please-use-yarn', yarn: '>= 1.19.1' },
2:48:00 PM: npm WARN EBADENGINE   current: { node: 'v16.14.1', npm: '8.5.0' }
2:48:00 PM: npm WARN EBADENGINE }
2:48:11 PM: npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
2:48:19 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
2:48:32 PM: added 1464 packages, and audited 1465 packages in 33s
2:48:32 PM: 173 packages are looking for funding
2:48:32 PM:   run `npm fund` for details
2:48:32 PM: 6 moderate severity vulnerabilities
2:48:32 PM: To address all issues (including breaking changes), run:
2:48:32 PM:   npm audit fix --force
2:48:32 PM: Run `npm audit` for details.
2:48:32 PM: NPM modules installed
2:48:32 PM: Started restoring cached go cache
2:48:32 PM: Finished restoring cached go cache
2:48:32 PM: go version go1.16.5 linux/amd64
2:48:32 PM: go version go1.16.5 linux/amd64
2:48:32 PM: Installing missing commands
2:48:32 PM: Verify run directory
2:48:33 PM: ​
2:48:33 PM: ────────────────────────────────────────────────────────────────
2:48:33 PM:   Netlify Build                                                 
2:48:33 PM: ────────────────────────────────────────────────────────────────
2:48:33 PM: ​
2:48:33 PM: ❯ Version
2:48:33 PM:   @netlify/build 26.4.0
2:48:33 PM: ​
2:48:33 PM: ❯ Flags
2:48:33 PM:   baseRelDir: true
2:48:33 PM:   buildId: 6231ab3673a7c73469d33e7d
2:48:33 PM:   deployId: 6231ab3673a7c73469d33e7f
2:48:33 PM: ​
2:48:33 PM: ❯ Current directory
2:48:33 PM:   /opt/build/repo/frontend
2:48:33 PM: ​
2:48:33 PM: ❯ Config file
2:48:33 PM:   No config file was defined: using default values.
2:48:33 PM: ​
2:48:33 PM: ❯ Context
2:48:33 PM:   production
2:48:33 PM: ​
2:48:33 PM: ────────────────────────────────────────────────────────────────
2:48:33 PM:   1. Build command from Netlify app                             
2:48:33 PM: ────────────────────────────────────────────────────────────────
2:48:33 PM: ​
2:48:33 PM: $ npm run build
2:48:34 PM: > frontend@0.1.0 build
2:48:34 PM: > react-scripts build
2:48:35 PM: Creating an optimized production build...
2:48:37 PM: warn - The `purge`/`content` options have changed in Tailwind CSS v3.0.
2:48:37 PM: warn - Update your configuration file to eliminate this warning.
2:48:37 PM: warn - https://tailwindcss.com/docs/upgrade-guide#configure-content-sources
2:48:37 PM: warn - The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.
2:48:37 PM: warn - Change `darkMode` to `media` or remove it entirely.
2:48:37 PM: warn - https://tailwindcss.com/docs/upgrade-guide#remove-dark-mode-configuration
2:49:06 PM: 
2:49:06 PM: Treating warnings as errors because process.env.CI = true.
2:49:06 PM: Most CI servers set it automatically.
2:49:06 PM: 
2:49:06 PM: Failed to compile.
2:49:06 PM: 
2:49:06 PM: src/App.js
2:49:06 PM:   Line 14:6:  React Hook useEffect has a missing dependency: 'navigate'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
2:49:06 PM: src/components/Pin.jsx
2:49:06 PM:   Line 108:17:  Using target="_blank" without rel="noreferrer" (which implies rel="noopener") is a security risk in older browsers: see https://mathiasbynens.github.io/rel-noopener/#recommendations  react/jsx-no-target-blank
2:49:06 PM: src/components/PinDetails.jsx
2:49:06 PM:   Line 10:10:  'MdMaximize' is defined but never used                                                                              no-unused-vars
2:49:06 PM:   Line 16:10:  'addingComment' is assigned a value but never used                                                                  no-unused-vars
2:49:06 PM:   Line 64:6:   React Hook useEffect has a missing dependency: 'fetchPinDetails'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
2:49:06 PM: src/components/UserProfile.jsx
2:49:06 PM:   Line 53:6:  React Hook useEffect has a missing dependency: 'activeBtn'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
2:49:06 PM: src/container/Home.jsx
2:49:06 PM:   Line 33:6:  React Hook useEffect has a missing dependency: 'userInfo?.googleId'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
2:49:06 PM: ​
2:49:06 PM: ────────────────────────────────────────────────────────────────
2:49:06 PM:   "build.command" failed                                        
2:49:06 PM: ────────────────────────────────────────────────────────────────
2:49:06 PM: ​
2:49:06 PM:   Error message
2:49:06 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
2:49:06 PM: ​
2:49:06 PM:   Error location
2:49:06 PM:   In Build command from Netlify app:
2:49:06 PM:   npm run build
2:49:06 PM: ​
2:49:06 PM:   Resolved config
2:49:06 PM:   build:
2:49:06 PM:     base: /opt/build/repo/frontend
2:49:06 PM:     command: npm run build
2:49:06 PM:     commandOrigin: ui
2:49:06 PM:     environment:
2:49:06 PM:       - REACT_APP_GOOGLE_TOKEN
2:49:06 PM:       - REACT_APP_SANITY_PROJECTID
2:49:06 PM:       - REACT_APP_SANITY_TOKEN
2:49:06 PM:     publish: /opt/build/repo/frontend/build
2:49:06 PM:     publishOrigin: ui
2:49:06 PM:   redirects:
2:49:06 PM:     - from: /*
      status: 200
      to: /index.html
Caching artifacts
2:49:06 PM: Started saving node modules
2:49:06 PM: Finished saving node modules
2:49:06 PM: Started saving build plugins
2:49:06 PM: Finished saving build plugins
2:49:06 PM: Started saving pip cache
2:49:06 PM: Finished saving pip cache
2:49:06 PM: Started saving emacs cask dependencies
2:49:06 PM: Finished saving emacs cask dependencies
2:49:06 PM: Started saving maven dependencies
2:49:06 PM: Finished saving maven dependencies
2:49:06 PM: Started saving boot dependencies
2:49:07 PM: Finished saving boot dependencies
2:49:07 PM: Started saving rust rustup cache
2:49:07 PM: Finished saving rust rustup cache
2:49:07 PM: Started saving go dependencies
2:49:07 PM: Finished saving go dependencies
2:49:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:49:11 PM: Creating deploy upload records
2:49:11 PM: Failing build: Failed to build site
2:49:11 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:49:11 PM: Finished processing build request in 1m27.044135368s
EN

回答 1

Stack Overflow用户

发布于 2022-03-16 10:20:32

您的代码中有多个警告/错误,需要进行修复才能编译。将来,请考虑在您的本地机器上编译一个开发构建,然后再将您的代码推送到代码服务器,如GitHub或Netlify。读取错误消息也会有帮助。

也请将错误消息封装在代码块中。和插入新行时,必要时。这将使其他人更容易阅读您的错误消息。

TailwindCSS警告(1)

在使用purge v3时,将TailwindCSS属性更改为content

代码语言:javascript
复制
// tailwind.config.js

module.exports = {
  content: [
    // ...
  ],
};

文档

TailwindCSS警告(2)

在TailwindCSS v3中,设置为falsedarkMode与设置为mediadarkMode相同。完全移除它,因为它不再需要了。只在需要将其设置为class时才使用它。

代码语言:javascript
复制
// tailwind.config.js

module.exports = {
  dark: false, // remove this
};

文档

反应ESLint错误(3)

代码中的useEffect()似乎缺少了一个依赖项:navigate。根据代码的工作方式,您需要删除整个依赖项数组,或者将navigate依赖项添加到其中。

移除整个依赖数组:

代码语言:javascript
复制
// src/App.js
// line 14:6

useEffect(() => {
  // ...
});

添加navigate 依赖项的:

代码语言:javascript
复制
// src/App.js
// line 14:6

useEffect(() => {
  // ...
}, [navigate]);

以下情况也是如此:

  • fetchPinDetailssrc/components/PinDetails.jsx第64:6行
  • activeBtnsrc/components/UserProfile.jsx第53:6行
  • userInfo?.googleIdsrc/container/Home.jsx第33:6行

HTML/React警告(4)

在旧的浏览器中,如果您有一个在新选项卡(a.k.a )上打开的链接。( target="_blank"),不包括rel="noreferrer"是一种安全风险。添加它以移除警告。如果您熟悉这一点,它也意味着noopener,所以您不需要添加它。

代码语言:javascript
复制
// src/components/Pin.jsx
// line 108:17

<a href="/example-page" target="_blank" rel="noreferrer">
  // ...
</a>

ESLint警告(5-6)

您有已定义的变量,但它从未在任何地方使用。除非你需要使用,否则把它们移走。

  • MdMaximizesrc/components/PinDetails.jsx第10行:10
  • addingCommentsrc/components/PinDetails.jsx第16:10行

以后,请在进入堆栈溢出之前阅读错误消息。如果读取所有这些错误或警告并引用它们的链接文档页,则可以轻松解决这些错误或警告。

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

https://stackoverflow.com/questions/71494498

复制
相关文章

相似问题

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