11

I am building SSR rendered Gatsby react application and I get the following error while doing "gatsby build". Been searching for a solution for this error for a good couple of days as it is hard to find out what is causing this error from the description itself. All the description says is "Callback was already called"

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

10 Answers 10

8

I am using vuejs (which uses webpack) and was running into this same issue. I was using yarn as my package manager and tried upgrading and reinstalling all my dependencies and clearing cache, nothing seemed to work.

Although I did find a solution for my case. It seems vuejs (or webpack - not entirely sure) is very case sensitive to the file and folder names, I had various case styles in my absolute folder path which seemed to cause a problem in git bash. When I used cmd however, it did work. I have reason to believe that cmd normalizes this issue.

In brief: Try cmd if git bash gave you errors.

Sign up to request clarification or add additional context in comments.

1 Comment

I ran in to the same error when trying to build vue code using a PowerShell window, using CMD instead did the trick.
5

This can happen on Windows if your current directory on the command prompt doesn't match the casing of the folder you are in.

Let's say, for example, your project is in C:\Development\project (the Development folder has a capital letter at the start).

If the path to the current directory on your shell is C:\development\project (lowercase D in Directory, which is incorrect), which Windows will happily allow, it can cause this problem when using vue-cli. To get around it, change the current directory's path on your shell to use proper capitalization.

Comments

4

After days of searching for a solution for this nerve-wracking. Updating all my packages, this way below, removed the error.

npm install -g npm-check-updates
ncu -u
npm install

2 Comments

What does this solution actually do?
it seems like it will update all dependencies in your package.json
4

I had similar error building Vuejs webpack project, But then I tried running build command using "nodejs command prompt" which was successful without error,

So I realized I should "update/upgrade Powershell" itself, which removed this darkness forever 😊

1 Comment

This! Using Powershell 7 did it for me.
2

After a lot of searching and doing trial and error, I found out that I need to remove Webpack from my installed packages. After I removed webpack and re-ran YARN/ NPM this error was gone.

2 Comments

I've been working through this issue as well. I haven't been able to find the true culprit. I've seen a few open issues, but I'm surprised more people aren't encountering this. For me, I updated nothing but suddenly started encountering this issue. Could you share your package versions?
just use node 16 nvm use 16
1

I've had this issue unexpectedly pop-up today as well. I ended up removing the cache, public, and node_modules directories and reverting to my previous package-lock.json and package.json files. Running npm i again fixed it somehow. Not sure what the deal was.

Comments

0

Solution

Rename all your folder names to lowercase, for ex. C:/Projects/Vue-App/ to C:/projects/vue-app/.

If didn't work, delete node_modules folder and reinstall packages: npm install or yarn.

1 Comment

Similarly, in Powershell on Windows, I had a single character incorrectly capitalized in my project path. Simply correcting this single character resolved the issue (did not need to upgrade or reset node_modules. I did upgrade to PowerShell7 to no immediate avail).
0

In my case, I've craco setup for a react-app that is also a PWA enabled. I was importing some function from seperate custom module into the service-worker.js file which was causing this issue. `import {getAppVersion} from @XXX/shared'. Commenting this line did the trick.

Comments

0

I ran into this issue in a React project. The solution was to bump yarn down from v2.4.2 to v1.22.19, and Node from v19.2.0 to v14.21.0. Kind of annoying, but this resolved the callback issue.

Comments

0

I had this error because i was using an incompatible version of Angular with Node

Is there a compatibility list for Angular / Angular-CLI and Node.js?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.