我是一个初学者和idk如何解决这个错误,我已经尝试通过改变部署设置解决,但无法修复这个编译错误,我不明白这些错误要我做什么,除了这些太多的语法错误有什么我不知道?
下面是日志部署
5:02:48 PM: Preparing Git Reference refs/heads/master
5:02:49 PM: Parsing package.json dependencies
5:02:49 PM: Failed to generate package.json data, continuing with build
5:02:49 PM: Starting build script
5:02:49 PM: Installing dependencies
5:02:49 PM: Python version set to 2.7
5:02:50 PM: v16.19.0 is already installed.
5:02:50 PM: Now using node v16.19.0 (npm v8.19.3)
5:02:50 PM: Enabling Node.js Corepack
5:02:50 PM: Started restoring cached build plugins
5:02:50 PM: Finished restoring cached build plugins
5:02:50 PM: Attempting Ruby version 2.7.2, read from environment
5:02:51 PM: Using Ruby version 2.7.2
5:02:51 PM: Using PHP version 8.0
5:02:51 PM: Started restoring cached corepack dependencies
5:02:51 PM: Finished restoring cached corepack dependencies
5:02:51 PM: No npm workspaces detected
5:02:51 PM: Started restoring cached node modules
5:02:51 PM: Finished restoring cached node modules
5:02:51 PM: Bypassing sha validation. Running pre & post install scripts
5:02:51 PM: Installing npm packages using npm version 8.19.3
5:03:10 PM: added 438 packages, and audited 439 packages in 19s
5:03:10 PM: 100 packages are looking for funding
5:03:10 PM: run `npm fund` for details
5:03:10 PM: 1 high severity vulnerability
5:03:10 PM: To address all issues, run:
5:03:10 PM: npm audit fix
5:03:10 PM: Run `npm audit` for details.
5:03:10 PM: npm packages installed
5:03:11 PM: Started restoring cached go cache
5:03:11 PM: Finished restoring cached go cache
5:03:11 PM: go version go1.19.5 linux/amd64
5:03:11 PM: Detected 1 framework(s)
5:03:11 PM: "next" at version "12.3.0"
5:03:11 PM: Installing missing commands
5:03:11 PM: Verify run directory
5:03:11 PM: Section completed: initializing
5:03:12 PM:
5:03:12 PM: Netlify Build
5:03:12 PM: ────────────────────────────────────────────────────────────────
5:03:12 PM:
5:03:12 PM: ❯ Version
5:03:12 PM: @netlify/build 29.5.4
5:03:12 PM:
5:03:12 PM: ❯ Flags
5:03:12 PM: baseRelDir: true
5:03:12 PM: buildId: 63e0ec4c48ae074d1e9ce655
5:03:12 PM: deployId: 63e0ec4c48ae074d1e9ce657
5:03:12 PM:
5:03:12 PM: ❯ Current directory
5:03:12 PM: /opt/build/repo
5:03:12 PM:
5:03:12 PM: ❯ Config file
5:03:12 PM: No config file was defined: using default values.
5:03:12 PM:
5:03:12 PM: ❯ Context
5:03:12 PM: production
5:03:12 PM:
5:03:12 PM: ❯ Installing plugins
5:03:12 PM: - @netlify/plugin-nextjs@4.30.3
5:03:19 PM:
5:03:19 PM: ❯ Using Next.js Runtime - v4.30.3
5:03:20 PM:
5:03:20 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
5:03:20 PM: ────────────────────────────────────────────────────────────────
5:03:20 PM:
5:03:20 PM: No Next.js cache to restore.
5:03:20 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
5:03:20 PM:
5:03:20 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
5:03:20 PM:
5:03:20 PM: 2. Build command from Netlify app
5:03:20 PM: ────────────────────────────────────────────────────────────────
5:03:20 PM:
5:03:20 PM: $ CI='' npm run build
5:03:21 PM: > material-kit-react@2.1.1 build
5:03:21 PM: > next build
5:03:21 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
5:03:21 PM: info - Linting and checking validity of types...
5:03:24 PM:
5:03:24 PM: Failed to compile.
5:03:24 PM: ./src/components/account/account-profile-details.js
5:03:24 PM: 51:16 Warning: Prop `props` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 60:20 Warning: Prop `xs` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 73:20 Warning: Prop `xs` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 84:24 Warning: Prop `md` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 95:24 Warning: Prop `md` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 106:24 Warning: Prop `md` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 117:24 Warning: Prop `md` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 130:46 Warning: Prop `value` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 146:35 Warning: Prop `variant` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: ./src/components/account/account-profile.js
5:03:24 PM: 39:41 Warning: Prop `gutterBottom` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 42:43 Warning: Prop `variant` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 45:43 Warning: Prop `variant` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 52:31 Warning: Prop `fullWidth` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: ./src/components/account-popover.js
5:03:24 PM: 39:44 Warning: Prop `variant` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: ./src/components/auth-guard.js
5:03:24 PM: 42:5 Warning: React Hook useEffect has missing dependencies: 'isAuthenticated' and 'router'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
5:03:24 PM: ./src/components/layout.js
5:03:24 PM: 39:54 Warning: Prop `open` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: ./src/components/nav-item.js
5:03:24 PM: 22:29 Warning: Prop `passHref` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: ./src/components/navbar.js
5:03:24 PM: 75:39 Warning: Prop `onClick` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: 106:33 Warning: Prop `handleClose` must be placed on a new line react/jsx-max-props-per-line
5:03:24 PM: ./src/components/settings/settings-password.js
5:03:24 PM: 129:49 Warning: Prop `title` must be placed on a new line react/jsx-max-props-per-
5:03:24 PM: ./src/pages/Update/index.js
5:03:24 PM: 38:33 Error: React Hook "useState" is called in function "index" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
5:03:24 PM: 39:35 Error: React Hook "useState" is called in function "index" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
5:03:24 PM: 40:33 Error: React Hook "useState" is called in function "index" that is neither a
5:03:24 PM: "build.command" failed
5:03:24 PM: ────────────────────────────────────────────────────────────────
5:03:24 PM:
5:03:24 PM: Error message
5:03:24 PM: Command failed with exit code 1: CI='' npm run build (https://ntl.fyi/exit-code-1)
5:03:24 PM:
5:03:24 PM: Error location
5:03:24 PM: In Build command from Netlify app:
5:03:24 PM: CI='' npm run build
5:03:24 PM:
5:03:24 PM: Resolved config
5:03:24 PM: build:
5:03:24 PM: command: CI='' npm run build
5:03:24 PM: commandOrigin: ui
5:03:24 PM: environment:
5:03:24 PM: - NEXT_PRIVATE_TARGET
5:03:24 PM: publish: /opt/build/repo/build
5:03:24 PM: publishOrigin: ui
5:03:24 PM: plugins:
5:03:24 PM: - inputs: {}
5:03:24 PM: origin: ui
5:03:24 PM: package: '@netlify/plugin-nextjs'
5:03:24 PM: Caching artifacts
5:03:24 PM: Started saving node modules
5:03:24 PM: Finished saving node modules
5:03:24 PM: Started saving build plugins
5:03:24 PM: Finished saving build plugins
5:03:24 PM: Started saving corepack cache
5:03:24 PM: Finished saving corepack cache
5:03:24 PM: Started saving pip cache
5:03:24 PM: Finished saving pip cache
5:03:24 PM: Started saving emacs cask dependencies
5:03:24 PM: Finished saving emacs cask dependencies
5:03:24 PM: Started saving maven dependencies
5:03:24 PM: Finished saving maven dependencies
5:03:24 PM: Started saving boot dependencies
5:03:24 PM: Finished saving boot dependencies
5:03:24 PM: Started saving rust rustup cache
5:03:24 PM: Finished saving rust rustup cache
5:03:24 PM: Started saving go dependencies
5:03:24 PM: Finished saving go dependencies
5:03:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:03:25 PM: Failing build: Failed to build site
5:03:25 PM: Finished processing build request in 37.866s
这是我的部署设置
enter image description here
1条答案
按热度按时间pinkon5k1#
我认为这只是代码中的一个问题。如果你试图在本地运行
yarn build
或npm run build
,它也会在同一个组件上失败。由于Eslint在开始构建之前会首先检查编写的代码是否正确,是否使用了正确的最佳实践,EsLint似乎发现了一个编译失败的组件,并对您在构建之前没有修复它大吼大叫。
上面是这么说的:
它基本上是对开发人员说,嘿,看看这个文件
account-profile-details.js
它可能有一些问题...既然你没有分享这个文件的内容,我就不能再帮你了。但是我最好的猜测是看看上面的文件,试着找出它不工作的原因。
祝你好运!