我最近克隆了我的网络网站。在我的克隆的 github 存储库上通过 netlify 部署后,出现以下错误
gatsby-plugin-netlify-cms" threw an error while running the onCreateWebpackConfig lifecycle:
Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
这在原始网站上从未发生过。gatsby develop
和gatsby build
在我的克隆上运行良好。我已经为克隆创建了一个单独的algolia帐户和新的ENV密钥,以解决潜在的冲突。
我已经检查了原始文件和克隆babel-loader.js
文件,它们与stage="test"
相同
我的一个与 babel 相关的文件没有正确更新还是什么?
原始 Github 存储库
克隆的 Github 存储库
我的完整错误报告:
6:11:05 PM: Build ready to start
6:11:07 PM: build-image version: 9d79ad851d6eff3969322d6e5b1df3d597650c41
6:11:07 PM: build-image tag: v3.3.19
6:11:07 PM: buildbot version: 8e2e5a3a5212190d0490c1372e313994f9085345
6:11:08 PM: Fetching cached dependencies
6:11:08 PM: Failed to fetch cache, continuing with build
6:11:08 PM: Starting to prepare the repo for build
6:11:08 PM: No cached dependencies found. Cloning fresh repo
6:11:08 PM: git clone https://github.com/uicscribe/yonseiuicscribe
6:11:22 PM: Preparing Git Reference refs/heads/master
6:11:25 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
6:11:25 PM: Starting build script
6:11:25 PM: Installing dependencies
6:11:25 PM: Python version set to 2.7
6:11:26 PM: v12.18.0 is already installed.
6:11:26 PM: Now using node v12.18.0 (npm v6.14.4)
6:11:26 PM: Started restoring cached build plugins
6:11:26 PM: Finished restoring cached build plugins
6:11:26 PM: Attempting ruby version 2.7.1, read from environment
6:11:28 PM: Using ruby version 2.7.1
6:11:28 PM: Using PHP version 5.6
6:11:28 PM: 5.2 is already installed.
6:11:28 PM: Using Swift version 5.2
6:11:28 PM: Started restoring cached node modules
6:11:28 PM: Finished restoring cached node modules
6:11:28 PM: Installing NPM modules using NPM version 6.14.4
6:12:18 PM: > sharp@0.25.3 install /opt/build/repo/node_modules/gatsby-plugin-manifest/node_modules/sharp
6:12:18 PM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
6:12:18 PM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
6:12:20 PM: > sharp@0.25.3 install /opt/build/repo/node_modules/sharp
6:12:20 PM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
6:12:20 PM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.9.1-linux-x64.tar.gz
6:12:21 PM: > node-sass@4.13.1 install /opt/build/repo/node_modules/node-sass
6:12:21 PM: > node scripts/install.js
6:12:22 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/linux-x64-72_binding.node
6:12:22 PM: Download complete
6:12:22 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
6:12:22 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.13.1/linux-x64-72_binding.node
6:12:23 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-circle/node_modules/core-js
6:12:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:23 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-fisheye/node_modules/core-js
6:12:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:23 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-shadow/node_modules/core-js
6:12:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:23 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-threshold/node_modules/core-js
6:12:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:23 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js
6:12:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:23 PM: > core-js-pure@3.6.4 postinstall /opt/build/repo/node_modules/core-js-pure
6:12:23 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:24 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/core-js
6:12:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:24 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/gatsby-transformer-sharp/node_modules/core-js
6:12:24 PM: > node -e "try{require('./postinstall')}catch(e){}"
6:12:25 PM: > gatsby-telemetry@1.1.47 postinstall /opt/build/repo/node_modules/gatsby-telemetry
6:12:25 PM: > node src/postinstall.js || true
6:12:25 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin
6:12:25 PM: > node lib/install.js
6:12:26 PM: ✔ cwebp pre-build test passed successfully
6:12:26 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
6:12:26 PM: > node lib/install.js
6:12:27 PM: ✔ mozjpeg pre-build test passed successfully
6:12:27 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
6:12:27 PM: > node lib/install.js
6:12:27 PM: ✔ pngquant pre-build test passed successfully
6:12:27 PM: > gatsby-cli@2.8.27 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
6:12:27 PM: > node scripts/postinstall.js
6:12:27 PM: > gatsby@2.19.7 postinstall /opt/build/repo/node_modules/gatsby
6:12:27 PM: > node scripts/postinstall.js
6:12:28 PM: > node-sass@4.13.1 postinstall /opt/build/repo/node_modules/node-sass
6:12:28 PM: > node scripts/build.js
6:12:28 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
6:12:28 PM: Testing binary
6:12:28 PM: Binary is fine
6:12:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
6:12:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:12:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/chokidar/node_modules/fsevents):
6:12:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:12:31 PM: added 2693 packages from 1182 contributors and audited 2766 packages in 62.382s
6:12:34 PM: 113 packages are looking for funding
6:12:34 PM: run `npm fund` for details
6:12:34 PM: found 93 vulnerabilities (90 low, 2 moderate, 1 high)
6:12:34 PM: run `npm audit fix` to fix them, or `npm audit` for details
6:12:35 PM: NPM modules installed
6:12:35 PM: Started restoring cached go cache
6:12:35 PM: Finished restoring cached go cache
6:12:35 PM: go version go1.14.4 linux/amd64
6:12:35 PM: go version go1.14.4 linux/amd64
6:12:35 PM: Installing missing commands
6:12:35 PM: Verify run directory
6:12:36 PM:
6:12:36 PM: ┌─────────────────────────────┐
6:12:36 PM: │ Netlify Build │
6:12:36 PM: └─────────────────────────────┘
6:12:36 PM:
6:12:36 PM: ❯ Version
6:12:36 PM: @netlify/build 2.0.20
6:12:36 PM:
6:12:36 PM: ❯ Flags
6:12:36 PM: deployId: 5efc532996e3900007f07514
6:12:36 PM: mode: buildbot
6:12:36 PM:
6:12:36 PM: ❯ Current directory
6:12:36 PM: /opt/build/repo
6:12:36 PM:
6:12:36 PM: ❯ Config file
6:12:36 PM: No config file was defined: using default values.
6:12:36 PM:
6:12:36 PM: ❯ Context
6:12:36 PM: production
6:12:36 PM:
6:12:36 PM: ┌────────────────────────────────┐
6:12:36 PM: │ 1. Build command from settings │
6:12:36 PM: └────────────────────────────────┘
6:12:36 PM:
6:12:36 PM: $ gatsby build
6:12:39 PM: success open and validate gatsby-configs - 0.030s
6:12:41 PM: success load plugins - 1.738s
6:12:41 PM: success onPreInit - 0.025s
6:12:41 PM: success delete html and css files from previous builds - 0.010s
6:12:41 PM: success initialize cache - 0.010s
6:12:41 PM: success copy gatsby files - 0.036s
6:12:41 PM: success onPreBootstrap - 0.005s
6:12:41 PM: success createSchemaCustomization - 0.019s
6:12:45 PM: success source and transform nodes - 4.156s
6:12:46 PM: success building schema - 0.802s
6:12:47 PM: success createPages - 0.295s
6:12:47 PM: success createPagesStatefully - 0.127s
6:12:47 PM: success onPreExtractQueries - 0.000s
6:12:47 PM: success update schema - 0.033s
6:12:47 PM: success extract queries from components - 0.698s
6:12:47 PM: success write out requires - 0.012s
6:12:47 PM: success write out redirect data - 0.001s
6:12:48 PM: success Build manifest and related icons - 0.246s
6:12:48 PM: success onPostBootstrap - 0.248s
6:12:48 PM: ⠀
6:12:48 PM: info bootstrap finished - 11.242 s
6:12:48 PM: ⠀
6:12:49 PM: error "gatsby-plugin-netlify-cms" threw an error while running the onCreateWebpackConfig lifecycle:
6:12:49 PM: Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
6:12:49 PM: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /opt/build/repo/node_modules/@babel/helper-compilation-targets/package.json
6:12:49 PM: at applyExports (internal/modules/cjs/loader.js:491:9)
6:12:49 PM: at resolveExports (internal/modules/cjs/loader.js:507:23)
6:12:49 PM: at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
6:12:49 PM: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
6:12:49 PM: at Function.Module._load (internal/modules/cjs/loader.js:842:27)
6:12:49 PM: at Module.require (internal/modules/cjs/loader.js:1026:19)
6:12:49 PM: at require (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
6:12:49 PM: at Object.<anonymous> (/opt/build/repo/node_modules/@babel/preset-env/lib/debug.js:8:33)
6:12:49 PM: at Module._compile (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
6:12:49 PM: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
6:12:49 PM: at Module.load (internal/modules/cjs/loader.js:986:32)
6:12:49 PM: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
6:12:49 PM: at Module.require (internal/modules/cjs/loader.js:1026:19)
6:12:49 PM: at require (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
6:12:49 PM: at Object.<anonymous> (/opt/build/repo/node_modules/@babel/preset-env/lib/index.js:11:14)
6:12:49 PM: at Module._compile (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
6:12:49 PM:
6:12:49 PM:
6:12:49 PM: ModuleBuildError: Module build failed (from ./node_modules/gatsby/dist/utils/b abel-loader.js):
6:12:49 PM: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /opt/buil d/repo/node_modules/@babel/helper-compilation-targets/package.json
6:12:49 PM:
6:12:49 PM: - loader.js:491 applyExports
6:12:49 PM: internal/modules/cjs/loader.js:491:9
6:12:49 PM:
6:12:49 PM: - loader.js:507 resolveExports
6:12:49 PM: internal/modules/cjs/loader.js:507:23
6:12:49 PM:
6:12:49 PM: - loader.js:635 Function.Module._findPath
6:12:49 PM: internal/modules/cjs/loader.js:635:31
6:12:49 PM:
6:12:49 PM: - loader.js:953 Function.Module._resolveFilename
6:12:49 PM: internal/modules/cjs/loader.js:953:27
6:12:49 PM:
6:12:49 PM: - loader.js:842 Function.Module._load
6:12:49 PM: internal/modules/cjs/loader.js:842:27
6:12:49 PM:
6:12:49 PM: - loader.js:1026 Module.require
6:12:49 PM: internal/modules/cjs/loader.js:1026:19
6:12:49 PM:
6:12:49 PM: - v8-compile-cache.js:159 require
6:12:49 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
6:12:49 PM:
6:12:49 PM: - debug.js:8 Object.<anonymous>
6:12:49 PM: [repo]/[@babel]/preset-env/lib/debug.js:8:33
6:12:49 PM:
6:12:49 PM: - v8-compile-cache.js:178 Module._compile
6:12:49 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
6:12:49 PM:
6:12:49 PM: - loader.js:1158 Object.Module._extensions..js
6:12:49 PM: internal/modules/cjs/loader.js:1158:10
6:12:49 PM:
6:12:49 PM: - loader.js:986 Module.load
6:12:49 PM: internal/modules/cjs/loader.js:986:32
6:12:49 PM:
6:12:49 PM: - loader.js:879 Function.Module._load
6:12:49 PM: internal/modules/cjs/loader.js:879:14
6:12:49 PM:
6:12:49 PM: - loader.js:1026 Module.require
6:12:49 PM: internal/modules/cjs/loader.js:1026:19
6:12:49 PM:
6:12:49 PM: - v8-compile-cache.js:159 require
6:12:49 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
6:12:49 PM:
6:12:49 PM: - index.js:11 Object.<anonymous>
6:12:49 PM: [repo]/[@babel]/preset-env/lib/index.js:11:14
6:12:49 PM:
6:12:49 PM: - v8-compile-cache.js:178 Module._compile
6:12:49 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
6:12:49 PM:
6:12:49 PM: - NormalModule.js:316
6:12:49 PM: [repo]/[gatsby-plugin-netlify-cms]/[webpack]/lib/NormalModule.js:316:20
6:12:49 PM:
6:12:49 PM: - LoaderRunner.js:367
6:12:49 PM: [repo]/[loader-runner]/lib/LoaderRunner.js:367:11
6:12:49 PM:
6:12:49 PM: - LoaderRunner.js:233
6:12:49 PM: [repo]/[loader-runner]/lib/LoaderRunner.js:233:18
6:12:49 PM:
6:12:49 PM: - LoaderRunner.js:111 context.callback
6:12:49 PM: [repo]/[loader-runner]/lib/LoaderRunner.js:111:13
6:12:49 PM:
6:12:49 PM: - index.js:55
6:12:49 PM: [repo]/[babel-loader]/lib/index.js:55:103
6:12:49 PM:
6:12:49 PM:
6:12:49 PM: not finished run queries - 1.495s
6:12:49 PM: not finished Generating image thumbnails - 1.448s
6:12:49 PM: not finished Building production JavaScript and CSS bundles - 1.347s
6:12:49 PM:
6:12:49 PM: ┌─────────────────────────────┐
6:12:49 PM: │ "build.command" failed │
6:12:49 PM: └─────────────────────────────┘
6:12:49 PM:
6:12:49 PM: Error message
6:12:49 PM: Command failed with exit code 1: gatsby build
6:12:49 PM:
6:12:49 PM: Error location
6:12:49 PM: In Build command from settings:
6:12:49 PM: gatsby build
6:12:49 PM:
6:12:49 PM: Resolved config
6:12:49 PM: build:
6:12:49 PM: command: gatsby build
6:12:49 PM: publish: /opt/build/repo/public
6:12:49 PM: Caching artifacts
6:12:49 PM: Started saving node modules
6:12:49 PM: Finished saving node modules
6:12:49 PM: Started saving build plugins
6:12:49 PM: Finished saving build plugins
6:12:49 PM: Started saving pip cache
6:12:50 PM: Finished saving pip cache
6:12:50 PM: Started saving emacs cask dependencies
6:12:50 PM: Finished saving emacs cask dependencies
6:12:50 PM: Started saving maven dependencies
6:12:50 PM: Finished saving maven dependencies
6:12:50 PM: Started saving boot dependencies
6:12:50 PM: Finished saving boot dependencies
6:12:50 PM: Started saving go dependencies
6:12:50 PM: Finished saving go dependencies
6:12:53 PM: Error running command: Build script returned non-zero exit code: 1
6:12:53 PM: Failing build: Failed to build site
6:12:53 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
6:12:53 PM: Finished processing build request in 1m45.421790398s
删除了node_modules
和package-lock.json
,并npm install
重新安装所有内容。
我认为一些 babel 依赖项已经过时了。
答案灵感来自这个来源
你可以尝试把它添加到你的netlify.toml
[functions]
# Specifies `esbuild` for functions bundling
node_bundler = "esbuild"
来源: https://github.com/netlify/netlify-plugin-nextjs/issues/597