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

  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 

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 19
  • Comments: 83 (32 by maintainers)

Commits related to this issue

Most upvoted comments

This is still an issue.

A possible workaround if you’re using yarn is to add the following to package.json:

"resolutions": {
    "mini-css-extract-plugin": "0.11.2"
  },

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 has registerPreviewTemplate

Update: downgrading gatsby-plugin-netlify-cms from 4.10.0 to 4.9.0 worked for me

This 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:

{
  resolve: 'gatsby-plugin-netlify-cms',
  options: {
    modulePath: `${__dirname}/src/cms/cms.js`,
  },
},

with:

{
  resolve: 'gatsby-plugin-netlify-cms',
},

and i also had to replace

'gatsby-plugin-sass',  

with

{
  resolve: 'gatsby-plugin-sass',
  options: {
      indentedSyntax: true
  },
}, 

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

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.

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.

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.

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.

image

Oh, nvm. The issue is gone after I cleared netlify’s cache and rebuilt the site 👍

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

Hi all 👋 Erez from Netlify here. Going to start looking into this issue. I somehow think this is related to having custom preview templates + a dirty cache, but not sure what the actual cause of the error yet.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/24577#issuecomment-781295883, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQIOD4ZNQMG73DO7PBO6VTS7T62ZANCNFSM4NNIVFEA .

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.

# node --version
v16.18.0
# gatsby -v
Gatsby CLI version: 4.24.0
Gatsby version: 4.24.6

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.

Hi @michaelcorley the "resolutions" field in package.json only works if you’re using yarn.

This tool might work for npm but I haven’t tested it.

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.

@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

I’m not using any of these plugins but still got this same error. Any idea how to fix it?

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.

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?

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!

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.