gpt4 book ai didi

gatsby - Netlify 部署抛出 : Error: Invalid version: “1”

转载 作者:行者123 更新时间:2023-12-04 12:58:33 27 4
gpt4 key购买 nike

从昨天开始,我遇到了一个无法修复或无法找到相关信息的错误。我可以在本地构建我的站点而不会出错,但是当我尝试在 Netlify 中部署它时,它失败并抛出:

8:19:33 AM: ​
8:19:33 AM: ┌─────────────────────────────┐
8:19:33 AM: │ Netlify Build │
8:19:33 AM: └─────────────────────────────┘
8:19:33 AM: ​
8:19:33 AM: ❯ Version
8:19:33 AM: @netlify/build 2.0.20
8:19:33 AM: ​
8:19:33 AM: ❯ Flags
8:19:33 AM: deployId: 5efc2a7760231502ad0a057d
8:19:33 AM: mode: buildbot
8:19:33 AM: ​
8:19:33 AM: ❯ Current directory
8:19:33 AM: /opt/build/repo
8:19:33 AM: ​
8:19:33 AM: ❯ Config file
8:19:33 AM: /opt/build/repo/netlify.toml
8:19:33 AM: ​
8:19:33 AM: ❯ Context
8:19:33 AM: production
8:19:33 AM: ​
8:19:33 AM: ┌─────────────────────────────┐
8:19:33 AM: │ Core internal error │
8:19:33 AM: └─────────────────────────────┘
8:19:33 AM: ​
8:19:33 AM: Error message
8:19:33 AM: Error: Invalid version: "1"
8:19:33 AM: ​
8:19:33 AM: Error location
8:19:33 AM: at Object.fixVersionField (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/fixer.js:191:13)
8:19:33 AM: at /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/normalize.js:32:38
8:19:33 AM: at Array.forEach (<anonymous>)
8:19:33 AM: at normalize (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/normalize.js:31:15)
8:19:33 AM: at module.exports (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/read-pkg/index.js:20:36)
8:19:33 AM: at async module.exports (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/read-pkg-up/index.js:14:16)
8:19:33 AM: at async getPackageJson (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/utils/package.js:7:22)
8:19:33 AM: at async build (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/core/main.js:61:46)
8:19:33 AM: at async runCli (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/core/bin.js:17:29)
8:19:33 AM: ​
8:19:33 AM: Error properties
8:19:33 AM: { name: 'Error' }
8:19:33 AM: ​
8:19:33 AM: Caching artifacts
8:19:33 AM: Started saving node modules
8:19:33 AM: Finished saving node modules
8:19:33 AM: Started saving build plugins
8:19:33 AM: Finished saving build plugins
8:19:33 AM: Started saving yarn cache
8:19:33 AM: Finished saving yarn cache
8:19:33 AM: Started saving pip cache
8:19:33 AM: Finished saving pip cache
8:19:33 AM: Started saving emacs cask dependencies
8:19:33 AM: Finished saving emacs cask dependencies
8:19:33 AM: Started saving maven dependencies
8:19:33 AM: Finished saving maven dependencies
8:19:33 AM: Started saving boot dependencies
8:19:33 AM: Finished saving boot dependencies
8:19:34 AM: Started saving go dependencies
8:19:35 AM: Finished saving go dependencies
8:19:39 AM: Error running command: Build script returned non-zero exit code: 1
8:19:39 AM: Failing build: Failed to build site
8:19:39 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
8:19:39 AM: Finished processing build request in 2m10.478232047s
它似乎与 Node 版本有关,所以我尝试通过添加 .nvmrc 来修复。但错误仍然存​​在。两者(本地和 Netlify)都在运行 Node 版本 12.16.3 .
当然,我也尝试在清理缓存的情况下进行构建。
这个问题没有提供更多信息,所以我有点迷茫。

最佳答案

根据 https://github.com/netlify/build/issues/1608这是一个已知问题,应该在下一个 Netlify 版本中修复。同时,您可以通过更改 version 轻松修复它。字段在 package.json来自 11.0.0 :

"version": "1.0.0",
这是因为,根据 npm documentation :

Version must be parseable by node-semver, which is bundled with npm asa dependency. (npm install semver to use it yourself.)

关于gatsby - Netlify 部署抛出 : Error: Invalid version: “1” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62671228/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com