question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Watch command throws "JavaScript heap out of memory" while using with tailwindcss

See original GitHub issue
  • Laravel Mix Version: 6.0
  • Node Version (node -v): 15.4
  • NPM Version (npm -v): 6.14.8
  • OS:

Description:

I am using laravel-mix with tailwindcss and compiling with SASS. When running on “npm run watch”, the first compilation takes some time but does it successfully. After i make a small change on one of the file, the command throws error like “FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory”.

I hoped that it would be solved in version 6 but it still persists. After trying out these solutions on #2470 and others but still to no vein.

So far debugging it i found that if i don’t import @tailwind utilities, there’s no any issue. However I do not have any work around it.

Here’s my webpack.mix.js file:

// Compile SASS/CSS.
mix.sass( `${devPath}/scss/app.scss`,             'css', sassConfig )    
    .options({
        processCssUrls: false,
	    postCss: [ tailwindcss('./tailwind.config.js') ]
    })

My app.scss file:

@tailwind base;
@tailwind components;
@tailwind utilities;

@import 'settings/_index';
@import 'tools/_index';

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:9

github_iconTop GitHub Comments

4reactions
jamesburrow23commented, Jan 3, 2021

@ponopress not sure if you’re still having this issue but I was able to work around it by adjusting my package.json file to include the node module flag to increase the maximum memory (in my example to 8000 MB):

"scripts": {
  "development": "NODE_OPTIONS=\"--max-old-space-size=8000\" mix "
}
1reaction
mikebronnercommented, Feb 13, 2021

In case anyone is looking for the reference to building tailwind using NPX, see the following page: https://tailwindcss.com/docs/installation#building-your-css

Read more comments on GitHub >

github_iconTop Results From Across the Web

Watch command throws "JavaScript heap out of memory ...
I am using laravel-mix with tailwindcss and compiling with SASS. When running on " npm run watch ", the first compilation takes some...
Read more >
Watch command slow and sometimes throws "JavaScript ...
Watch command slow and sometimes throws "JavaScript heap out of memory" while using with tailwindcss.
Read more >
Tailwind CSS (PostCSS Plugin) with Next.js 10.0.3 gives ...
I have set up Gulp for Tailwindcss and pm2 to restart when memory exceeds 1024 MB. I know this setup is very annoying...
Read more >
How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. Here's an example...
Read more >
Ineffective mark-compacts near heap limit Allocation failed ...
How to fix FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory in nodejs, try it 100%...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found