Unexpected error during building next.js project

Viewed 330

When I try to build my next.js project I am getting this error:

> next build
       
       info  - Creating an optimized production build...
       info  - Compiled successfully
       info  - Collecting page data...
       info  - Generating static pages (0/5)
       info  - Generating static pages (1/5)
       info  - Generating static pages (2/5)
       info  - Generating static pages (3/5)
       info  - Generating static pages (5/5)
       info  - Finalizing page optimization...
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
 1: 0xa89e60 node::Abort() [node]
 2: 0x9ade29 node::FatalError(char const*, char const*) [node]
 3: 0xc7555a v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0xdfdde2 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [node]
 5: 0xe10b7c v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [node]
 6: 0xe22b8e v8::internal::Factory::NewStringFromOneByte(v8::internal::Vector<unsigned char const> const&, v8::internal::AllocationType) [node]
       
 7: 0xc8cf72 v8::String::NewFromOneByte(v8::Isolate*, unsigned char const*, v8::NewStringType, int) [node]
 8: 0xc3a317 node::crypto::TLSWrap::InvokeQueued(int, char const*) [node]
 9: 0xc3a422  [node]
10: 0xc3a5e4 node::crypto::TLSWrap::~TLSWrap() [node]
11: 0xc3a751 node::crypto::TLSWrap::~TLSWrap() [node]
12: 0xa20c5b node::Environment::RunCleanup() [node]
13: 0x9d670c node::FreeEnvironment(node::Environment*) [node]
14: 0xb52249 node::worker::Worker::Run() [node]
15: 0xb529c8  [node]
16: 0x7ff424e31609  [/lib/x86_64-linux-gnu/libpthread.so.0]
17: 0x7ff424d58293 clone [/lib/x86_64-linux-gnu/libc.so.6]
Aborted
-----> Build failed

Node version: 15.14.0 Npm version: 7.7.6

I do not know why this is failing. It works randomly on local machine an always fails on Heroku. I can't find any solution or related problem.

0 Answers
Related