在Netlify上建立盖茨比网站-错误:回调已被调用

时间:2020-01-03 08:24:17

标签: gatsby netlify

我无法解决在netlify上构建gatsby网站的问题。几天以来,我收到以下错误消息:

3:17:52 PM: error UNHANDLED EXCEPTION Callback was already called.
3:17:52 PM: 
3:17:52 PM:   Error: Callback was already called.
3:17:52 PM:   
3:17:52 PM:   - async.js:16 throwError
3:17:52 PM:     [repo]/[neo-async]/async.js:16:11
3:17:52 PM:   
3:17:52 PM:   - async.js:2818 
3:17:52 PM:     [repo]/[neo-async]/async.js:2818:7
3:17:52 PM:   
3:17:52 PM:   - next_tick.js:132 _combinedTickCallback
3:17:52 PM:     internal/process/next_tick.js:132:7
3:17:52 PM:   
3:17:52 PM:   - next_tick.js:181 process._tickCallback
3:17:52 PM:     internal/process/next_tick.js:181:clock9

Package.json

{
  "name": "gatsby-starter-netlify-cms",
  "description": "Example Gatsby, and Netlify CMS project",
  "version": "1.1.3",
  "author": "Austin Green",
  "dependencies": {
    "bulma": "0.7.5",
    "gatsby": "2.17.0",
    "gatsby-image": "2.2.29",
    "gatsby-plugin-disqus": "1.1.4",
    "gatsby-plugin-google-tagmanager": "2.1.15",
    "gatsby-plugin-netlify": "2.1.22",
    "gatsby-plugin-netlify-cms": "3.0.18",
    "gatsby-plugin-offline": "2.2.10",
    "gatsby-plugin-purgecss": "2.4.0",
    "gatsby-plugin-react-helmet": "3.1.13",
    "gatsby-plugin-robots-txt": "1.5.0",
    "gatsby-plugin-sass": "2.1.20",
    "gatsby-plugin-sharp": "2.2.32",
    "gatsby-plugin-sitemap": "2.2.21",
    "gatsby-remark-autolink-headers": "2.1.16",
    "gatsby-remark-copy-linked-files": "2.1.28",
    "gatsby-remark-images": "3.1.28",
    "gatsby-remark-prismjs": "3.3.20",
    "gatsby-remark-relative-images": "^0.2.3",
    "gatsby-source-filesystem": "2.1.33",
    "gatsby-transformer-remark": "2.6.30",
    "gatsby-transformer-sharp": "2.3.0",
    "lodash": "4.17.15",
    "lodash-webpack-plugin": "0.11.4",
    "netlify-cms": "2.9.7",
    "node-sass": "4.12.0",
    "parcel-bundler": "1.12.4",
    "prismjs": "1.17.1",
    "prop-types": "15.7.2",
    "react": "16.10.2",
    "react-dom": "16.10.2",
    "react-helmet": "5.2.1",
    "uuid": "3.3.3"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "main": "n/a",
  "scripts": {
    "start": "npm run develop",
    "clean": "rimraf .cache public",
    "build": "npm run clean && gatsby build",
    "develop": "npm run clean && gatsby develop",
    "serve": "gatsby serve",
    "format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"{gatsby-*.js,src/**/*.js}\"",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "prettier": "1.18.2",
    "rimraf": "2.7.1"
  }
}

使用节点8。

此处提供完整的部署日志:https://app.netlify.com/sites/gallant-mcnulty-8ac2d3/deploys/5e0a0637af09c64352a2e783

在localhost服务器上,一切正常。 我尝试在新的netlify实例上构建网站,但遇到相同的错误。

谢谢您的建议。

欢呼

2 个答案:

答案 0 :(得分:4)

我有同样的问题。将gatsby-plugin-netlify-cms更新到最新版本有帮助。

答案 1 :(得分:1)

即使拥有gatsby-plugin-netlify-cms,最近也遇到了相同的构建问题。我的问题是netlify默认使用节点版本10。我用节点版本12设置了我的项目。

要设置要部署的节点版本,可以在netlify UI中设置一个NODE_VERSION,也可以使用.node-version.nvmrc在项目根目录中设置一个。因此,在项目根目录的v12中添加.node-version可以解决构建问题。

https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript