我有这个登陆页面,我把代码放在了一个 github repo 上,然后,我尝试在 netlify 上部署它,但是,这个错误一直出现。
6:53:00 PM: ────────────────────────────────────────────────────────────────
6:53:00 PM: "build.command" failed
6:53:00 PM: ────────────────────────────────────────────────────────────────
6:53:00 PM:
6:53:00 PM: Error message
6:53:00 PM: Command failed with exit code 1: next build && next export
6:53:00 PM:
6:53:00 PM: Error location
6:53:00 PM: In Build command from Netlify app:
6:53:00 PM: next build && next export
6:53:00 PM:
6:53:00 PM: Resolved config
6:53:00 PM: build:
6:53:00 PM: command: next build && next export
6:53:00 PM: commandOrigin: ui
6:53:00 PM: publish: /opt/build/repo/out
6:53:00 PM: publishOrigin: ui
6:53:00 PM: functions:
6:53:00 PM: '*': {}
6:53:00 PM: plugins:
6:53:00 PM: - inputs: {}
6:53:00 PM: origin: ui
6:53:00 PM: package: '@netlify/plugin-nextjs'
6:53:00 PM: Caching artifacts
6:53:00 PM: Started saving node modules
6:53:00 PM: Finished saving node modules
6:53:00 PM: Started saving build plugins
6:53:00 PM: Finished saving build plugins
6:53:00 PM: Started saving pip cache
6:53:00 PM: Finished saving pip cache
6:53:00 PM: Started saving emacs cask dependencies
6:53:00 PM: Finished saving emacs cask dependencies
6:53:00 PM: Started saving maven dependencies
6:53:00 PM: Finished saving maven dependencies
6:53:00 PM: Started saving boot dependencies
6:53:00 PM: Finished saving boot dependencies
6:53:00 PM: Started saving rust rustup cache
6:53:00 PM: Finished saving rust rustup cache
6:53:00 PM: Started saving go dependencies
6:53:00 PM: Finished saving go dependencies
6:53:03 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:53:03 PM: Creating deploy upload records
6:53:03 PM: Failing build: Failed to build site
6:53:03 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
6:53:03 PM: Finished processing build request in 1m25.941100434s
这是我的包 json
{
"name": "costureria-landing-page",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"babel-plugin-styled-components": "^1.12.1",
"framer-motion": "^4.1.17",
"next": "11.0.1",
"next-images": "^1.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intersection-observer": "^8.32.0",
"react-responsive": "^8.2.0",
"styled-components": "^5.3.0"
},
"devDependencies": {
"eslint": "7.29.0",
"eslint-config-next": "11.0.1"
}
}
我尝试使用的命令是 next build && next export,我也尝试了 npm run build,但我对所有这些命令都遇到了问题。
如果你想检查其他东西,这是 github repo
这是怎么回事,我该如何解决?感谢您的时间
重要更新
我尝试在本地运行 next build && next export,这是错误
info - No "exportPathMap" found in "next.config.js". Generating map from "./pages"
Error: Image Optimization using Next.js' default loader is not compatible with `next export`.
Possible solutions:
- Use `next start` to run a server, which includes the Image Optimization API.
- Use any provider which supports Image Optimization (like Vercel).
- Configure a third-party loader in `next.config.js`.
- Use the `loader` prop for `next/image`.
Read more: https://nextjs.org/docs/messages/export-image-api
at C:\Users\diego cifuentes\Desktop\Portafolio\Landing Pages\Costureria - Landing Page - Next.js\costureria-landing-page\node_modules\next\dist\export\index.js:14:785
at async Span.traceAsyncFn (C:\Users\diego cifuentes\Desktop\Portafolio\Landing Pages\Costureria - Landing Page - Next.js\costureria-landing-page\node_modules\next\dist\telemetry\trace\trace.js:6:584)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! costureria-landing-page@0.1.0 export: `next build && next export`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the costureria-landing-page@0.1.0 export script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\diego cifuentes\AppData\Roaming\npm-cache\_logs\2021-07-06T01_29_13_977Z-debug.log
我可以使用 npm run build && npm run start 部署到 netlify 吗?或者我该怎么做才能使用 Image from next/image