Gatsby: cli: yoga-layout-prebuilt error on gatsby build

Created on 28 May 2020  Β·  42Comments  Β·  Source: gatsbyjs/gatsby

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

  1. Start a new gatsby project or just run npm update; and,
  2. Try to execute gatsby develop or build or serve.

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 
not stale cli bug

Most helpful comment

This is still an issue.

All 42 comments

Having a similar error when running netlify dev on a gatsby project. Running locally with gatsby develop is OK.

/Users/mikeguppy/Code/xxxx/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

I'm on gatsby version 2.22.9, and gatsby cli version 2.12.21

What are node version you are using? We also do need some kind of reproduction for it.

Same issue here #24589

@pieh I'm on node v14.2.0

Also if it helps: macOS Catalina 10.15.4

@pieh I just created a new gatsby project and updated to:

Gatsby CLI version: 2.12.21
Gatsby version: 2.22.12
Node version `14.2.0`

and gatsby develop runs fine.

My issue was with running netlify dev, which threw an exception on that yoga-layout-prebuilt package same as @alexandresgf original post

What are node version you are using? We also do need some kind of reproduction for it.

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 any 2.22.XX it stops working.

Can be related: #22558, #23214, #24411, https://github.com/gatsbyjs/gatsby/issues/22991#issuecomment-630381390

I wonder if this is case of some error being eaten by ink and hiding real problem that is not actually related to ink - could you try running CI=1 gatsby develop (or CI=1 netlify dev in case of @moreguppy)?

This should force using "legacy" logger (which is not using yoga-layout-prebuilt) - if there are errors - we can inspect them. If there are no errors we can at least be more sure that it is somewhat related to ink logger

I'm also running into this problem. Ran the CI=1 gatsby develop which prints:

> [email protected] develop /home/gustav/Development/lm
> CI=1 gatsby develop

/home/gustav/Development/lm/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:811:20)
    at process.target.send (internal/child_process.js:682:19)
    at /home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ipc/index.js:58:13
    at dispatch (/home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:54:5)
    at /home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/internal-actions.js:42:7
    at dispatch (/home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:33:5)
    at /home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:30:28
    at Array.forEach (<anonymous>)
    at dispatch (/home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:30:12)
    at Reporter.pendingActivity (/home/gustav/Development/lm/node_modules/redux/lib/redux.js:483:12)
    at module.exports (/home/gustav/Development/lm/node_modules/gatsby/dist/commands/develop-process.js:410:21)
    at Object.<anonymous> (/home/gustav/Development/lm/.cache/tmp-43477-3sp50vYLAonc:4:5)
    at Module._compile (internal/modules/cjs/loader.js:1118:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Function.Module._load (internal/modules/cjs/loader.js:875:14)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/home/gustav/Development/lm/node_modules/signal-exit/index.js:155:32)
    at internal/child_process.js:815:39
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  errno: -13,
  code: 'EACCES',
  syscall: 'write'
}

Gatsby version: 2.23.3

You could probably work around this by installing ink and running with the ink logger.

GATSBY_LOGGER=ink gatsby develop

It's strange that gatsby is picking the ipc logger. The reason it's failing is because the ipc logger sends it's data to the parent process. But i don't understand why there is a parent process here when just running gatsby develop.

@blainekasten Unfortunately not:

kolle-on-xps :: Development/lm Β» GATSBY_LOGGER=ink npx gatsby develop
/home/gustav/Development/lm/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:811:20)
    at process.target.send (internal/child_process.js:682:19)
    at /home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ipc/index.js:58:13
    at dispatch (/home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:54:5)
    at /home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/internal-actions.js:42:7
    at dispatch (/home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:33:5)
    at /home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:30:28
    at Array.forEach (<anonymous>)
    at dispatch (/home/gustav/Development/lm/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/redux/index.js:30:12)
    at Reporter.pendingActivity (/home/gustav/Development/lm/node_modules/redux/lib/redux.js:483:12)
    at module.exports (/home/gustav/Development/lm/node_modules/gatsby/dist/commands/develop-process.js:410:21)
    at Object.<anonymous> (/home/gustav/Development/lm/.cache/tmp-46528-C7kBELRkUd53:4:5)
    at Module._compile (internal/modules/cjs/loader.js:1118:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Function.Module._load (internal/modules/cjs/loader.js:875:14)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/home/gustav/Development/lm/node_modules/signal-exit/index.js:155:32)
    at internal/child_process.js:815:39
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  errno: -13,
  code: 'EACCES',
  syscall: 'write'
}

even after installing ink:

kolle-on-xps :: Development/louise-michel Β» npm ls -g | grep ink
β”œβ”€β”¬ [email protected]
β”‚ β”œβ”€β”¬ [email protected]
β”‚ β”‚ β”œβ”€β”€ [email protected] deduped
β”‚ β”‚ β”œβ”€β”€ [email protected] deduped

Let me know if I can do anything in helping you to debug this ...

Oh, I just realized you are using npx, I'm betting that's the problem. Can you try installing gatsby globally?

yarn global add gatsby-cli
gatsby develop

@blainekasten

kolle-on-xps :: Development/lm Β» npm ls -g | grep gatsby-cli
β”œβ”€β”¬ [email protected]

Unfortunately this dosn't change anything. Stacktrace looks exactly the same (even with GATSBY_LOGGER=ink gatsby develop).

I played around with the versions a bit: i breaks for me at 2.22.0 and works fine at 2.21.40 (the last version in 2.21.x). Does this help in any way?

@gustavpursche yes that narrows it down. We can check what changed between those versions. Thank you!

This is the publish commit for 2.21.40.
This is the publish commit for 2.22.0

The only commit between those two is d4ec5e5e081f46ae33578861bcfb29d9554e099a

Looks like this is when @mxstbr added the develop-process code.

@gustavpursche I'm curious, does npx work for you with other uses non gatsby related?

@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)

@blainekasten Had a look today, but I couldn't find anything useful here. :sob: The only thin I discoverd, which is different from the issue description is, that gatsby build and gatsby serve are working. The problem only occurs when running gatsby develop.

I've also tried it with gatsby-cli installed and without - same result. I'd be super happy if you or @mxstbr do have an idea. Happy to support you with anything you need.

@alexandresgf @moreguppy @MrUltimate

In case you are also still struggeling with this: I've created/ forked a docker project, which helps me now running gatsby with a recent version: https://github.com/gustavpursche/gatsby-docker

I am having the same issue on netlify with gatsby build:

3:47:30 PM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
3:47:30 PM:         throw ex;
3:47:30 PM:         ^
3:47:30 PM: Error: Callback was already called.
3:47:30 PM:     at throwError (/opt/build/repo/node_modules/neo-async/async.js:16:11)
3:47:30 PM:     at /opt/build/repo/node_modules/neo-async/async.js:2818:7
3:47:30 PM:     at processTicksAndRejections (internal/process/task_queues.js:79:11)
3:47:30 PM: error Command failed with exit code 7.
3:47:30 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Oh, nvm. The issue is gone after I cleared netlify's cache and rebuilt the site πŸ‘

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.

The stack trace shows the the develop child process trying to process.send an IPC message to the develop parent process (a reporter.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 with Error: 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?

I have faced the same issue on builds on Netlify.

image

I have this issue with local builds. See #26439 for details. None of the above "fixes" works for me...

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

@mcqj You are my hero. I can confirm that doing the same in yarn works. :sparkles:

Oh, nvm. The issue is gone after I cleared netlify's cache and rebuilt the site πŸ‘

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 nor gatsby build.

@mfuery yeah, that's exactly my case. But I don't want to manually restart builds every time when someone from my team open PR and preview fails with this error 😫

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 using npm 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.

So when I install the deps with npm I can build. Even run yarn build not npm run build. So that's the inverse of what @mcqj said.

Also it builds without issues in node v10. v12 and v14 are broken for me with yarn install. Unfortunately we use dependencies what require node v12 or higher...

rm -rf node_modules
yarn install
yarn build

worked for me. Thanks @mcqj

I haven't used npm install in years but somehow this yarn reinstall fixed things.

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

This is still an issue.

It is an issue, but clearing the cache almost always fixes it. Any thoughts on a potential solution?

I had the same issue.

rm -rf node_modules
yarn install
GATSBY_CPU_COUNT=1 yarn build

worked for me. That was the only solution that worked for me. I used yarn before.

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

not stale

the yoga prebuild is the catch all, the stack trace should tell you more where the real error is. GLib error means it's a sharp issue. Upgrading to the latest plugin-sharp might help here

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.

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.

Thanks. That fixed it for me.

Was this page helpful?
1 / 5 - 1 ratings

Related issues

ghost picture ghost  Β·  3Comments

benstr picture benstr  Β·  3Comments

jimfilippou picture jimfilippou  Β·  3Comments

brandonmp picture brandonmp  Β·  3Comments

theduke picture theduke  Β·  3Comments