gatsby-plugin-intl
gatsby-plugin-intl copied to clipboard
The run is blocked during the createPagesStatefully
When I add the plug-in run gatsby develop is blocked at this stage createPagesStatefully.Finally, throw Allocation failed
> gatsby develop
success open and validate gatsby-configs - 0.024 s
success load plugins - 0.460 s
success onPreInit - 0.024 s
success initialize cache - 0.516 s
success copy gatsby files - 2.455 s
success onPreBootstrap - 0.067 s
success source and transform nodes - 0.072 s
success building schema - 1.529 s
success createPages - 0.005 s
⠙ createPagesStatefully
<--- Last few GCs --->
[19280:000002901D5C17D0] 343097 ms: Scavenge 1305.9 (1423.7) -> 1305.1 (1424.2) MB, 4.5 / 0.0 ms (average mu = 0.284, curre
nt mu = 0.248) allocation failure
[19280:000002901D5C17D0] 343104 ms: Scavenge 1306.3 (1424.9) -> 1305.9 (1425.4) MB, 3.7 / 0.0 ms (average mu = 0.284, curre
nt mu = 0.248) allocation failure
[19280:000002901D5C17D0] 343117 ms: Scavenge 1306.7 (1425.4) -> 1306.0 (1425.9) MB, 4.6 / 0.0 ms (average mu = 0.284, curre
nt mu = 0.248) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 000000229A05C5C1]
Security context: 0x03efa411e6e1 <JSObject>
1: map [000003EFA4106E59](this=0x002bd8606059 <JSArray[49144]>,0x002bd8606079 <JSFunction (sfi = 000002BAE60D19D1)>)
2: /* anonymous */(aka /* anonymous */) [000001A856FA8849] [C:\Users\yeming\Desktop\work\madecare-website\node_modules\gat
sby\dist\redux\index.js:~72] [pc=000000229A3594C5](this=0x03c6fd8826f1 <undefined>)
3: _callee$(aka _callee...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF74DADECE5
2: 00007FF74DAB8196
3: 00007FF74DAB8BA0
4: 00007FF74DD48D5E
5: 00007FF74DD48C8F
6: 00007FF74E2869D4
7: 00007FF74E27D137
8: 00007FF74E27B6AC
9: 00007FF74E284627
10: 00007FF74E2846A6
11: 00007FF74DE27767
12: 00007FF74DEBF44A
13: 000000229A05C5C1
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] develop: `gatsby develop`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yeming\AppData\Roaming\npm-cache\_logs\2019-07-01T04_59_34_996Z-debug.log
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
gatsby-config.js
module.exports = {
/* Your site config here */
plugins:[
'gatsby-plugin-sass',
'gatsby-plugin-layout',
{
resolve:'gatsby-plugin-intl',
options:{
path:`${__dirname}/src/intl`,
languages:['en','zh'],
defaultLanguage:'zh',
}
}
]
}
package.json
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write src/**/*.{js,jsx}",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""
},
"dependencies": {
"gatsby": "^2.10.4",
"gatsby-plugin-intl": "^0.2.0",
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.4.4",
"babel-preset-gatsby": "^0.2.0",
"gatsby-plugin-layout": "^1.1.0",
"gatsby-plugin-react-css-modules": "^2.1.0",
"gatsby-plugin-sass": "^2.1.0",
"node-sass": "^4.12.0",
"prettier": "^1.18.2",
"sass-loader": "^7.1.0"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
gatsby-node.js
const replacePath = path => (path === `/` ? path.toLowerCase() : path.replace(/\/$/, ``).toLowerCase())
// Implement the Gatsby API “onCreatePage”. This is
// called after every page is created.
exports.onCreatePage = ({ page, actions }) => {
const { createPage, deletePage } = actions
const oldPage = Object.assign({}, page);
// Remove trailing slash unless page is /
page.path = replacePath(page.path);
//是否生成新页面
let createNews = false;
if (page.path !== oldPage.path) {
// Replace new page with old page
deletePage(oldPage);
createNews = true;
}
//设置不一样的状态
if (page.path.match(/solution/)) {
page.context.layout = 'solution';
createNews = true;
}
createNews && createPage(page);
}
Any luck solving this?
Not yet @ShawnSheehan
Same issue
Any updates on this?