- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试部署我的 nextjs 应用程序 netlify,但它一直向我抛出失败错误,没有部署这是我的 github 存储库 https://github.com/farishelmipermana/nextjs-portfolio.git ,我正在尝试通过更改 yarn build && next export
来修复,我遇到了问题 Cannot deploy Next.js to Netlify。由于@netlify/plugin-nextjs 插件错误导致部署失败
这是我的日志
12:10:08 PM: Build ready to start
12:10:11 PM: build-image version: a49edbc55fc722f80f6b85963a5060f8d043a844 (focal)
12:10:11 PM: build-image tag: v4.8.1
12:10:11 PM: buildbot version: 4d0ac5fd74188fe527fa2a661368485be00b8be6
12:10:12 PM: Fetching cached dependencies
12:10:12 PM: Failed to fetch cache, continuing with build
12:10:12 PM: Starting to prepare the repo for build
12:10:12 PM: No cached dependencies found. Cloning fresh repo
12:10:12 PM: git clone https://github.com/farishelmipermana/nextjs-portfolio
12:10:12 PM: Preparing Git Reference refs/heads/master
12:10:13 PM: Parsing package.json dependencies
12:10:14 PM: Starting build script
12:10:14 PM: Installing dependencies
12:10:14 PM: Python version set to 2.7
12:10:14 PM: v16.15.1 is already installed.
12:10:15 PM: Now using node v16.15.1 (npm v8.11.0)
12:10:15 PM: Started restoring cached build plugins
12:10:15 PM: Finished restoring cached build plugins
12:10:15 PM: Attempting ruby version 2.7.2, read from environment
12:10:16 PM: Using ruby version 2.7.2
12:10:16 PM: Using PHP version 8.0
12:10:16 PM: Started restoring cached yarn cache
12:10:16 PM: Finished restoring cached yarn cache
12:10:17 PM: No yarn workspaces detected
12:10:17 PM: Started restoring cached node modules
12:10:17 PM: Finished restoring cached node modules
12:10:17 PM: Installing NPM modules using Yarn version 1.22.10
12:10:17 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:10:17 PM: npm WARN config location in the cache, and they are managed by
12:10:17 PM: npm WARN config [`cacache`](http://npm.im/cacache).
12:10:17 PM: yarn install v1.22.10
12:10:18 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
12:10:18 PM: [1/4] Resolving packages...
12:10:18 PM: [2/4] Fetching packages...
12:10:25 PM: info @next/swc-win32-x64-msvc@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-win32-x64-msvc@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-android-arm64@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-android-arm64@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-android-arm64@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info @next/swc-android-arm-eabi@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-android-arm-eabi@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-android-arm-eabi@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info @next/swc-darwin-arm64@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-darwin-arm64@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-darwin-arm64@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info @next/swc-linux-arm-gnueabihf@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info "@next/swc-linux-arm-gnueabihf@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-linux-arm64-gnu@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info "@next/swc-linux-arm64-gnu@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-darwin-x64@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-darwin-x64@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-win32-ia32-msvc@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-win32-ia32-msvc@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-win32-ia32-msvc@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info @next/swc-win32-arm64-msvc@12.1.6: The platform "linux" is incompatible with this module.
12:10:25 PM: info "@next/swc-win32-arm64-msvc@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info @next/swc-win32-arm64-msvc@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info @next/swc-linux-arm64-musl@12.1.6: The CPU architecture "x64" is incompatible with this module.
12:10:25 PM: info "@next/swc-linux-arm64-musl@12.1.6" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
12:10:25 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
12:10:25 PM: [3/4] Linking dependencies...
12:10:25 PM: [4/4] Building fresh packages...
12:10:25 PM: success Saved lockfile.
12:10:25 PM: Done in 8.02s.
12:10:25 PM: NPM modules installed using Yarn
12:10:26 PM: Started restoring cached go cache
12:10:26 PM: Finished restoring cached go cache
12:10:26 PM: Installing Go version 1.17 (requested 1.17)
12:10:31 PM: unset GOOS;
12:10:31 PM: unset GOARCH;
12:10:31 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
12:10:31 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
12:10:31 PM: go version >&2;
12:10:31 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
12:10:31 PM: go version go1.17 linux/amd64
12:10:31 PM: Installing missing commands
12:10:31 PM: Verify run directory
12:10:33 PM:
12:10:33 PM: ────────────────────────────────────────────────────────────────
12:10:33 PM: Netlify Build
12:10:33 PM: ────────────────────────────────────────────────────────────────
12:10:33 PM:
12:10:33 PM: ❯ Version
12:10:33 PM: @netlify/build 27.1.6
12:10:33 PM:
12:10:33 PM: ❯ Flags
12:10:33 PM: baseRelDir: true
12:10:33 PM: buildId: 62b3f5b0d3c7f33c0246be8c
12:10:33 PM: deployId: 62b3f5b0d3c7f33c0246be8e
12:10:33 PM:
12:10:33 PM: ❯ Current directory
12:10:33 PM: /opt/build/repo
12:10:33 PM:
12:10:33 PM: ❯ Config file
12:10:33 PM: No config file was defined: using default values.
12:10:33 PM:
12:10:33 PM: ❯ Context
12:10:33 PM: production
12:10:33 PM:
12:10:33 PM: ❯ Installing plugins
12:10:33 PM: - @netlify/plugin-nextjs@4.9.1
12:10:43 PM:
12:10:43 PM: ❯ Loading plugins
12:10:43 PM: - @netlify/plugin-nextjs@4.9.1 from Netlify app
12:10:45 PM:
12:10:45 PM: ────────────────────────────────────────────────────────────────
12:10:45 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
12:10:45 PM: ────────────────────────────────────────────────────────────────
12:10:45 PM:
12:10:45 PM: No Next.js cache to restore.
12:10:45 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
12:10:45 PM:
12:10:45 PM: (@netlify/plugin-nextjs onPreBuild completed in 24ms)
12:10:45 PM:
12:10:45 PM: ────────────────────────────────────────────────────────────────
12:10:45 PM: 2. Build command from Netlify app
12:10:45 PM: ────────────────────────────────────────────────────────────────
12:10:45 PM:
12:10:45 PM: $ yarn build && next export
12:10:45 PM: yarn run v1.22.10
12:10:45 PM: $ next build
12:10:46 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
12:10:46 PM: info - Checking validity of types...
12:10:46 PM: warn - No ESLint configuration detected. Run next lint to begin setup
12:10:46 PM: info - Creating an optimized production build...
12:10:59 PM: info - Compiled successfully
12:10:59 PM: info - Collecting page data...
12:11:02 PM: info - Generating static pages (0/6)
12:11:02 PM: info - Generating static pages (1/6)
12:11:02 PM: info - Generating static pages (2/6)
12:11:02 PM: info - Generating static pages (4/6)
12:11:02 PM: info - Generating static pages (6/6)
12:11:03 PM: info - Finalizing page optimization...
12:11:03 PM: Page Size First Load JS
12:11:03 PM: ┌ ○ / 1.86 kB 79.5 kB
12:11:03 PM: ├ /_app 0 B 75.2 kB
12:11:03 PM: ├ ○ /404 193 B 75.4 kB
12:11:03 PM: ├ ○ /about 813 B 78.4 kB
12:11:03 PM: ├ ○ /contact 728 B 78.3 kB
12:11:03 PM: └ ○ /portfolio 747 B 78.4 kB
12:11:03 PM: + First Load JS shared by all 75.2 kB
12:11:03 PM: ├ chunks/framework-4556c45dd113b893.js 45.2 kB
12:11:03 PM: ├ chunks/main-d8b1ff545a609496.js 28.6 kB
12:11:03 PM: ├ chunks/pages/_app-fb3a3036b08bee65.js 508 B
12:11:03 PM: ├ chunks/webpack-69bfa6990bb9e155.js 769 B
12:11:03 PM: └ css/2ab3fddc65372c75.css 752 B
12:11:03 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
12:11:03 PM: Done in 17.71s.
12:11:03 PM: info - using build directory: /opt/build/repo/.next
12:11:03 PM: info - Copying "static build" directory
12:11:03 PM: info - No "exportPathMap" found in "undefined". Generating map from "./pages"
12:11:03 PM: info - Launching 7 workers
12:11:03 PM: info - Exporting (0/5)
12:11:03 PM: info - Copying "public" directory
12:11:04 PM: info - Exporting (1/5)
12:11:04 PM: info - Exporting (2/5)
12:11:04 PM: info - Exporting (3/5)
12:11:04 PM: info - Exporting (5/5)
12:11:04 PM: Export successful. Files written to /opt/build/repo/out
12:11:04 PM:
12:11:04 PM: (build.command completed in 19.4s)
12:11:04 PM:
12:11:04 PM: ────────────────────────────────────────────────────────────────
12:11:04 PM: 3. @netlify/plugin-nextjs (onBuild event)
12:11:04 PM: ────────────────────────────────────────────────────────────────
12:11:04 PM:
12:11:04 PM:
12:11:04 PM: ────────────────────────────────────────────────────────────────
12:11:04 PM: Plugin "@netlify/plugin-nextjs" failed
12:11:04 PM: ────────────────────────────────────────────────────────────────
12:11:04 PM:
12:11:04 PM: Error message
12:11:04 PM: Error: The directory "/opt/build/repo/out" does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
12:11:04 PM: Your publish directory is set to "out", but in most cases it should be ".next".
12:11:04 PM: If you are using "next export" then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to "true".
12:11:04 PM:
12:11:04 PM: Plugin details
12:11:04 PM: Package: @netlify/plugin-nextjs
12:11:04 PM: Version: 4.9.1
12:11:04 PM: Repository: git+https://github.com/netlify/netlify-plugin-nextjs.git
12:11:04 PM: npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
12:11:04 PM: Report issues: https://github.com/netlify/netlify-plugin-nextjs/issues
12:11:04 PM:
12:11:04 PM: Error location
12:11:04 PM: In "onBuild" event in "@netlify/plugin-nextjs" from Netlify app
12:11:04 PM: at checkNextSiteHasBuilt (/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/helpers/verification.js:72:16)
12:11:04 PM: at onBuild (/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/index.js:41:50)
12:11:04 PM:
12:11:04 PM: Resolved config
12:11:04 PM: build:
12:11:04 PM: command: yarn build && next export
12:11:04 PM: commandOrigin: ui
12:11:04 PM: environment:
12:11:04 PM: - NEXT_PRIVATE_TARGET
12:11:04 PM: publish: /opt/build/repo/out
12:11:04 PM: publishOrigin: ui
12:11:04 PM: plugins:
12:11:04 PM: - inputs: {}
12:11:04 PM: origin: ui
12:11:04 PM: package: '@netlify/plugin-nextjs'
12:11:05 PM: Caching artifacts
12:11:05 PM: Started saving node modules
12:11:05 PM: Finished saving node modules
12:11:05 PM: Started saving build plugins
12:11:05 PM: Finished saving build plugins
12:11:05 PM: Started saving yarn cache
12:11:05 PM: Finished saving yarn cache
12:11:05 PM: Started saving pip cache
12:11:05 PM: Finished saving pip cache
12:11:05 PM: Started saving emacs cask dependencies
12:11:05 PM: Finished saving emacs cask dependencies
12:11:05 PM: Started saving maven dependencies
12:11:05 PM: Finished saving maven dependencies
12:11:05 PM: Started saving boot dependencies
12:11:05 PM: Finished saving boot dependencies
12:11:05 PM: Started saving rust rustup cache
12:11:05 PM: Finished saving rust rustup cache
12:11:05 PM: Started saving go dependencies
12:11:05 PM: Finished saving go dependencies
12:11:07 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:11:07 PM: Creating deploy upload records
12:11:07 PM: Failing build: Failed to build site
12:11:07 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:11:07 PM: Finished processing build request in 55.750494271s
我已经尝试将公共(public)目录设置为out
,但我仍然收到类似这样的错误Cannot deploy Next.js to Netlify。由于@netlify/plugin-nextjs 插件错误导致部署失败
我也删除了 netlify 中的所有插件,但仍然出现这样的错误 Cannot deploy Next.js to Netlify。由于@netlify/plugin-nextjs 插件错误导致部署失败
谢谢你的帮助
最佳答案
TL;DR:您需要在 Netlify UI 中添加值为 true
的 NETLIFY_NEXT_PLUGIN_SKIP
环境变量。然后,您可以将发布目录设置为 out
,这样就可以了。
根据您的构建命令,您正在使用 Next.js 的静态导出功能。这需要在 Netlify 上进行特殊配置,如下所述:https://github.com/netlify/netlify-plugin-nextjs#use-with-next-export
关于reactjs - 我无法将 Next.js 部署到 Netlify。由于@netlify/plugin-nextjs 插件错误导致部署失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72724257/
我已经为我的 NextJS 网站完全实现了 next-i18next。一切正常: 使用 i18next 中间件自动检测语言 使用语言选择按钮更改语言 仅在相关命名空间等中加载的翻译 但是,我想本地化路
nextjs 是如何处理 SEO 的?我试图通过从浏览器直接调用它 (localhost:8080/about) 来呈现页面,但 NGINX 返回 404。主页中嵌入的同一页面的链接有效,但无法使用
我有一个 react/nextjs 应用程序,我有 firebase.js 如下: import firebase from 'firebase/app' import 'firebase/auth'
我正在尝试将 Nextjs 与 graphql-tag/loader 集成,这是我的 next.config.js 文件: const withSass = require('@zeit/next-s
我使用的示例与文档使用的几乎相同。。我的完整代码(字面意思仅此而已):。当然,我可以使用reDirect()函数,但我需要将此重定向标记为永久重定向。。我研究了下一个/导航文件,其中没有permane
I use pretty the same example as documentation does.我使用的示例与文档使用的几乎相同。 My full code (literally no
为了部署 NodeJS,我使用 systemd 并配置/lib/systemd/system/[service_name].service 文件 ===========================
我只是尝试使用@sentry/nextjs 和 sentry 向导将 sentry 与 NextjS v12 集成,在集成 Sentry 之前在本地主机上一切正常,但是当我在 AWS Amplify
更新到 Nextjs 12.1.0 后,当我通过 api 路由调用 api 时,返回以下错误。我正在使用 aws amplify。 CloudFront 控制台返回以下错误: 我的 api 路由: c
我有一个简单的 nextjs 应用程序,在主页上我只显示一个包含 10 部电影的列表和一个按钮/链接,这会打开该电影的特定页面。在该页面上,我想显示该电影的所有内容。 我的第一种方法是像这样将电影 I
我正在开发 NextJS 应用程序,但我无法让 Image 组件正常工作。 正常的 img 元素使用与 Image 组件相同的 src 属性路径可以正常工作。 我的项目有标准的公用文件夹,里面有一个名
我是 NextJS 的新手,正在尝试弄清楚如何创建一个我可以随时分配不同值的全局变量。有人可以举一个简单的例子吗? (我知道全局可能不是最好的方法,但我仍然想知道如何设置全局变量)。 假设: _app
我有一个可通过以下 http://localhost(这是主应用程序的 url)访问的应用程序和另一个可通过 http://localhost/subapp(这是子应用程序的 url)访问的应用程序,
我在 Internet 上四处寻找解决此问题的方法,但仍未找到有效的方法。我尝试了以下状态管理工具: 使用上下文 终极版 坚持 后坐力 我希望我的 NextJS 站点在我单击一个简单按钮时更新每个页面
我在开发中发现重写代理到我的后端服务器: https://nextjs.org/docs/api-reference/next.config.js/rewrites rewrites: async (
我真的一直在努力了解如何在 nextjs 中处理环境变量,但我仍然不明白。我只是想从下面的代码中隐藏我的 API key 。据我了解,我只能通过使用 getServerSideProps 或 getS
我是 NextJS 的新手。我想知道 next/router 和 next/link 之间的典型变化和用例。 在各种情况下我应该使用哪一个?哪个做什么?例如,如果我想加载共享组件或在服务器端呈现的页面
我在 Next.js 中收到此错误: Error: The provided 'href' (/subject/[subject]) value is missing query values (su
我有外部目录 common我想将该目录中的 react 组件导入web-static .在 web-static我正在使用 nextjs。 目前我有这个错误:Module not found: Can
是否可以只为特定路由添加提供程序,而不是在下一个 js 中转到我的整个应用程序? my "pages" folder 我的上下文文件 [server.jsx] import { createConte
我是一名优秀的程序员,十分优秀!