gatsby: cli: yoga-layout-prebuilt error on gatsby build
Description
After an update did using the command npm update
and the Gatsby updated from 2.21.17 to 2.22.12 no command did using gatsby-cli
works anymore.
Steps to reproduce
- Start a new gatsby project or just run
npm update
; and, - Try to execute
gatsby develop
orbuild
orserve
.
Expected result
Expected to run the development server.
Actual result
/home/alexandre/projects/bestcanais/frontend/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
Error: write EACCES
at process.target._send (internal/child_process.js:806:20)
at process.target.send (internal/child_process.js:677:19)
at /home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ipc/index.js:58:13
at dispatch (/home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:54:5)
at /home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/internal-actions.js:42:7
at dispatch (/home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:33:5)
at /home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:30:28
at Array.forEach (<anonymous>)
at dispatch (/home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:30:12)
at Reporter.pendingActivity (/home/alexandre/projects/bestcanais/frontend/node_modules/redux/lib/redux.js:483:12)
at module.exports (/home/alexandre/projects/bestcanais/frontend/node_modules/gatsby/dist/commands/develop-process.js:413:21)
at Object.<anonymous> (/home/alexandre/projects/bestcanais/frontend/.cache/tmp-27267-PDO5cWsb1RYS:4:5)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
Emitted 'error' event on process instance at:
at processEmit [as emit] (/home/alexandre/projects/bestcanais/frontend/node_modules/signal-exit/index.js:161:32)
at internal/child_process.js:810:39
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
errno: 'EACCES',
code: 'EACCES',
syscall: 'write'
}
Environment
System:
OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz
Shell: 4.4.20 - /bin/bash
Languages:
Python: 2.7.17 - /home/alexandre/.pyenv/shims/python
Browsers:
Chrome: 83.0.4103.61
Firefox: 76.0.1
npmPackages:
gatsby: ^2.21.17 => 2.22.12
gatsby-image: ^2.4.5 => 2.4.5
gatsby-plugin-google-analytics: ^2.3.2 => 2.3.2
gatsby-plugin-manifest: ^2.4.9 => 2.4.9
gatsby-plugin-material-ui: ^2.1.9 => 2.1.9
gatsby-plugin-offline: ^3.2.7 => 3.2.7
gatsby-plugin-react-helmet: ^3.3.2 => 3.3.2
gatsby-plugin-sharp: ^2.6.9 => 2.6.9
gatsby-source-filesystem: ^2.3.8 => 2.3.8
gatsby-source-graphql: ^2.5.2 => 2.5.2
gatsby-transformer-sharp: ^2.5.3 => 2.5.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 19
- Comments: 83 (32 by maintainers)
Commits related to this issue
- Update npm dependencies * gatsby is currently at 2.21.40 due to the following issue https://github.com/gatsbyjs/gatsby/issues/24577 — committed to liamdalg/liamdalg.co.uk by liamdalg 4 years ago
- Upgrade gatsby-remark-relative-images to v2.0.2 Upgrade major version of gatsby-remark-relative-images from v0.3.0 to v2.0.2. Doing so requires some updates to the gatsby-node.js file to remove a de... — committed to martian111/gatsby-starter-netlify-cms by martian111 3 years ago
- Fixes build error, see https://github.com/gatsbyjs/gatsby/issues/24577 — committed to fredwu/fredwu.me-v3 by fredwu 3 years ago
- fix yoga prebuild error https://github.com/gatsbyjs/gatsby/issues/24577#issuecomment-784329598 — committed to hardforkio/homepage by levino 3 years ago
This is still an issue.
A possible workaround if you’re using
yarn
is to add the following topackage.json
:The underlying cause seems to be that both Gatsby and the CMS plugin have
mini-css-extract-plugin
as a dependency but with mismatching versions.Looks like a PR to solve it was already merged, but not released yet. I’ll verify everything works with the latest changes from Gatsby’s
master
branch.It only happens when
cms.js
hasregisterPreviewTemplate
Update: downgrading
gatsby-plugin-netlify-cms
from4.10.0
to4.9.0
worked for meThis issue is still present. I’ve tried clearing the cache, removing node_modules, tried with yarn and npm, after removing the lock files, tried on node v10, v12, v14, v15. I also tried upgrading all the packages to their latest versions. downgrading only introduced new issues related to reducers.
not stale
I’ve managed to solve this issue in my project. It had to do with importing sass in my Layout component. I switched to just linking to the compiled CSS. I now also link the CSS directly in the netlify CMS script though this might not be needed. This is just one quick and dirty way of solving this issue for now but there may be ways of resolving this by changing the sass compilation implementation. This issue refers to something like this and it gave me the idea to check the sass imports https://github.com/gatsbyjs/gatsby/issues/27891.
Are you all using netlify-cms?
i am using netlify-cms-app
I just removed the options section from gatsby-config.js as suggested here: https://github.com/gatsbyjs/gatsby/issues/27891 and the build seems to be working now…
I replaced:
with:
and i also had to replace
with
I would also recommend deleting the yarn.lock and or package-lock.json files you have in your project before doing a netlify build.
Still having this issue
Having a similar error when running
netlify dev
on a gatsby project. Running locally withgatsby develop
is OK.I’m on gatsby version 2.22.9, and gatsby cli version 2.12.21
As I said in #26439 I have an example commit to reproduce the issue. Just check it out. Also you can see the failing build here: https://app.circleci.com/pipelines/github/hardforkio/homepage/1229/workflows/1477ff4a-8837-48f6-a824-be816c58ed37/jobs/6321
I always use
yarn
for dep management. I tried usingnpm
to install the deps, no change.I really criticize that no one at gatsby carefully debugs this. We need to know what exactly is causing this issue. “Format C: and reinstall windows” is not a bug fixing procedure! This thing is blocking me for good. I have important changes that need to be shipped. This software is broken. In my case and as it looks to me in many others.
Hi all 👋 Erez from Netlify here. Going to start looking into this issue. I think this is somehow related to having custom preview templates + a dirty cache, but not sure what the actual cause of the error yet.
I just had the same issue, somewhat it was connected with imports to blog components in post preview in netlify cms. For me removing package-lock.json &&
rm -rf node_modules
&&npm install
was the solution.worked for me. Thanks @mcqj
I haven’t used npm install in years but somehow this yarn reinstall fixed things.
I’ve encountered a similar issue with local builds. A workaround that has worked form me is to use “yarn Install” on my project instead on “npm install” (after deleting node_modules). So far, I have not been able to determine why that makes a difference but it does and consistently. I’ve verified with both MacOS and Linux and with node v12.18.3 v12.13.0 and v14.8.0
I have faced the same issue on builds on Netlify.
Oh, nvm. The issue is gone after I cleared netlify’s cache and rebuilt the site 👍
Can be related: #22558, #23214, #24411, https://github.com/gatsbyjs/gatsby/issues/22991#issuecomment-630381390
@erezrokah removed “resolutions” workaround in packages.json, got the error, used 4.10.1 dependency --> worked! Thanks for your efforts !! #31093 is the man.
Hi Erez, this happens too when clearing cache (on Netlify). Also happens on local env with gatsby build. It is related to custom preview imports . Just importing the templates triggers the error. Thanks for looking into it!
On Thu, 18 Feb 2021 at 09:03, Erez Rokah notifications@github.com wrote:
also getting this issue during netlify build very frustrating nothing anyone has suggested has solved it for me …
12:15:53 AM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53 12:15:53 AM: throw ex; 12:15:53 AM: ^ 12:15:53 AM: Error: Callback was already called. 12:15:53 AM: at throwError (/opt/build/repo/node_modules/neo-async/async.js:16:11) 12:15:53 AM: at /opt/build/repo/node_modules/neo-async/async.js:2818:7 12:15:53 AM: at processTicksAndRejections (internal/process/task_queues.js:79:11) 12:15:53 AM: npm ERR! code ELIFECYCLE 12:15:53 AM: npm ERR! errno 7 12:15:53 AM: npm ERR! gatsby-starter-netlify-cms@1.1.3 build:
npm run clean && gatsby build12:15:53 AM: npm ERR! Exit status 7 12:15:53 AM: npm ERR! 12:15:53 AM: npm ERR! Failed at the gatsby-starter-netlify-cms@1.1.3 build script. 12:15:53 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 12:15:53 AM: npm ERR! A complete log of this run can be found in: 12:15:53 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-02-09T00_15_53_466Z-debug.log
I seem to be bumping into this as well.
I can’t find anything that helps me get past this error in the build process. Any information that might get me a step along the way would be much appreciated.
Dang, I get this error but I’m using
gatsby-source-sanity
as my data source.Hi @erezrokah,
Thanks for the prompt response - that’s sorted it! I have learned something new in now to resolve conflicts too - so, again, thank you!
Feel free to close this issue.
This was fixed with https://github.com/gatsbyjs/gatsby/pull/31093
Hi @michaelcorley the
"resolutions"
field inpackage.json
only works if you’re usingyarn
.This tool might work for
npm
but I haven’t tested it.I am having the same issue on netlify with gatsby build:
@pieh I just created a new gatsby project and updated to:
and
gatsby develop
runs fine.My issue was with running
netlify dev
, which threw an exception on thatyoga-layout-prebuilt
package same as @alexandresgf original postI’m not using any of these plugins but still got this same error. Any idea how to fix it?
I was getting this error when netlify tried to build. Clear Netlify Cache and Rebuild worked for me 🎉 p.s. I was not getting an error locally, neither via
gatsby develop
norgatsby build
.The stack trace shows the the develop child process trying to
process.send
an IPC message to the develop parent process (areporter.pendingActivity
call). This is supposed to happen and looks correct.However, the actual
process.send
call all the way at the top of the stack trace is failing withError: write EACCES
, which is the error code for “An attempt was made to access a file in a way forbidden by its file access permissions.”I have absolutely no clue why
process.send
would trigger a file access error 🤔 Maybe @sidharthachatterjee has run into this before?We had the same problem on CircleCI. After troubleshooting, this article helps us to solve this problem.
https://support.circleci.com/hc/en-us/articles/360038192673-NodeJS-Builds-or-Test-Suites-Fail-With-ENOMEM-or-a-Timeout
The container we used is 2CPU/4GB, so we limit gatsby to use only 1 CPU:
GATSBY_CPU_COUNT=1 yarn build
.@blainekasten The only regular npx command I’m (knowingly) using is
npx serve
- which works.I’m also using other globally installed node cli tools and they all work, so I guess it is not a permission issue.
🤷
(I’m on vacation this week but next week I’m happy to dive a bit deeper into the issue since I saw exciting new things at the gatsby horizon)
@gustavpursche yes that narrows it down. We can check what changed between those versions. Thank you!
node 12.17.0 LTS
I just downgrade and updated the Gatsby version to
~2.21.40
, and for now, it is working fine. If I try to update to any2.22.XX
it stops working.