Search code examples
node.jslinuxnext.jsyarnpkgarch

next js app creates error when starting dev server on Arch Linux


I am facing error when i run yarn run dev to run a next app. React js projects are working fine though.

What have I tried:

  • Reinstalling nodejs.
  • Used windows( It runs perfectly well on windows)

Here is the console output:

> [email protected] dev
> next dev

node[61231]: ../src/module_wrap.cc:599:v8::MaybeLocal<v8::Promise> node::loader::ImportModuleDynamically(v8::Local<v8::Context>, v8::Local<v8::Data>, v8::Local<v8::Value>, v8::Local<v8::String>, v8::Local<v8::FixedArray>): Assertion `(it) != (env->id_to_function_map.end())' failed.
 1: 0x7f60cea96e8d node::Abort() [/usr/bin/../lib/libnode.so.111]
 2: 0x7f60cea971d6 node::Assert(node::AssertionInfo const&) [/usr/bin/../lib/libnode.so.111]
 3: 0x7f60cea49a4d  [/usr/bin/../lib/libnode.so.111]
 4: 0x7f60cefd847a v8::internal::Isolate::RunHostImportModuleDynamicallyCallback(v8::internal::MaybeHandle<v8::internal::Script>, v8::internal::Handle<v8::internal::Object>, v8::internal::MaybeHandle<v8::internal::Object>) [/usr/bin/../lib/libnode.so.111]
 5: 0x7f60cf412b18 v8::internal::Runtime_DynamicImportCall(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/../lib/libnode.so.111]
 6: 0x7f60ced5a5f4  [/usr/bin/../lib/libnode.so.111]
zsh: IOT instruction (core dumped)  npm run dev

Solution

  • Switch to stable version of node js in linux, right now its 18.15.0,

    nvm install 18.15.0 && nvm use 18.15.0 
    

    This should solve the error, It worked on my laptop. I hope it helps you!