构建Gatsby站点在Netlify上出错:err:回调已经被调用

huangapple go评论60阅读模式
英文:

Building gatsby site on Netlify - err: Callback was already called

问题

无法在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"
  }
}

使用Node 8。

完整的部署日志可以在此处找到:https://app.netlify.com/sites/gallant-mcnulty-8ac2d3/deploys/5e0a0637af09c64352a2e783

在本地服务器上一切正常。
我尝试在新的Netlify实例上构建站点,但仍然遇到相同的错误。

感谢任何建议。

祝好。

英文:

I can’t resolve issue with building gatsby site on netlify. Since a few days I’m getting following error:

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"
}
}

Using Node 8.

Full deploy log available here: https://app.netlify.com/sites/gallant-mcnulty-8ac2d3/deploys/5e0a0637af09c64352a2e783

On localhost server all works well.
I tried build site on new netlify's instance but I’m getting the same error.

Thanks for any advice.

Cheers

答案1

得分: 9

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

英文:

I had the same issue. Updating gatsby-plugin-netlify-cms to latest version helped.

答案2

得分: 1

最近,即使在使用gatsby-plugin-netlify-cms之后,我仍然遇到了相同的构建问题。我的问题是netlify默认使用了Node版本10,而我已经在项目中设置了Node版本12。

要为部署设置Node版本,您可以在netlify UI中设置NODE_VERSION,或者在项目根目录中使用.node-version.nvmrc文件进行设置。因此,将v12添加到我的项目根目录中的.node-version文件中解决了构建问题。

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

英文:

Recently saw the same build issue even after having the gatsby-plugin-netlify-cms. My issue was that netlify defaulted to node version 10. I had setup my project with node version 12.

To set the node version for deploy you can set a NODE_VERSION in the netlify UI or you can set one in the project root with .node-version or .nvmrc. Thus, adding v12 to .node-version in my project root fixed the build issue.

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

huangapple
  • 本文由 发表于 2020年1月3日 16:24:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575264.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定