- 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/
这个问题已经有答案了: How to modify a public field of a field of a field… As in link.next.next.next(.next*n) n
我有一个保存链接的数组。每个链接都有一个名为 next 的公共(public)字段,它可以保存另一个链接,该链接可以保存更多链接等。当我想删除东西时我可以做 array[x].next = array
文档概述了在中间件中使用“await next()”的用例,导致中间件暂停并触发下游的下一个中间件,直到所有中间件都执行完毕,此时上游级联将开始并且中间件将完整执行。如果用户想要缩短级联,那么单独写“
我今天遇到了一个用例,我试图让我的 nextjs 应用程序在 android webview 中工作,不幸的是 android 不解析以 _next 开头的路径并且我的大部分块文件都在_next/st
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 8 年前。 Improve th
next-with-apollo npm 库和 the approach shown in next.js docs 中选择的“next.js 中的 apollo-client”方法对比. next.
我尝试使用 next-auth 获取凭据身份验证,但我没有使用它的经验,无论我做什么,我都会收到以下消息:[next-auth][error][callback_credentials_jwt_err
更改语言时需要更改路线名称。例如,我有一条路线 /en/career但是当我改成捷克语时,我需要一条路线 /cs/kariera .基本上我需要本地化 URL。现在,当我在 /en/career 上时
更好/优雅的方法是什么? jQuery(this).find('title').next().next().next().eq(0).text(); //THIS WORKS 我尝试使用 jQuery
我只是对 node 感到好奇。 node.next 和 node.next。到目前为止,我们已经了解到节点有两个部分,其中存储数据和下一个节点的地址(node.next),然后是 node.next.
好的,我正在尝试单独隐藏这组信息。 这有效: $(".arrow").click(function() { $(this).next().next().slideToggle(); }); Mo
我开发了一个 Web 应用程序,它使用 Nextjs 应用程序作为前端和一个 Python (Django) API 服务器作为后端。我的大多数前端页面都有对后端服务器的 API 调用(在 Compo
如果我没有通过身份验证,我正在尝试使用NextJS中间件保护一些路由,我正在使用Next-auth进行身份验证,从文档中看,这就是MIDDLEWAR.TS文件应该是什么样子。Rn的问题是,即使当我通过
我正在使用 nextJs,需要添加对 less 和 css 的支持。我想要一个项目同时拥有 next-css 和 next-less 。但它一次接受一个。这是我正在使用的 const withCSS
我正在构建下一个项目的 typescript 。如果我将此配置文件保留为 next.config.js , 我在 tsconfig.json 收到警告说“找不到next.config.ts”。所以 t
我有一个自定义登录网址/ View /模板。我对页面使用 @login_required 装饰器(让 称为 my_page) 需要登录。试图访问 my_site.com/my_page 正确调用 my
下面的代码工作正常: class String def foo next! end end puts 'hh'.foo # hi 这个也很好用: class String d
我在我的Next.js应用程序中使用Next-auth进行身份验证。成功登录后,我立即被重定向到登录页面,表明该会话已变为未经身份验证。。相关代码片段:。_app.tsx:。Layout.tsx:。L
我想在 nextjs 中创建动态页面以匹配以下路由 users/[user]/[dashboard]。我的文件结构 pages/ users/ -[user].js // will
我直接按照官网的步骤操作: https://nextjs.org/docs/ 第一步。 npm install --save next react react-dom 步骤 2. 将脚本添加到 pac
我是一名优秀的程序员,十分优秀!