升级到节点10导致Webpack构建错误

时间:2019-05-22 16:19:29

标签: node.js webpack

由于我今年12月在我使用Webpack构建的React前端上将Node 8终止,因此我最近从Node 8升级到Node 10。运行如下所示的webpack时出现错误:

/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node[99538]: ../src/node_file.cc:943:void node::fs::Stat(const FunctionCallbackInfo<v8::Value> &): Assertion `(argc) == (4)' failed.
 1: 0x10003c597 node::Abort() [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 2: 0x10003b5b9 node::AddEnvironmentCleanupHook(v8::Isolate*, void (*)(void*), void*) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 3: 0x100071e70 node::fs::Stat(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 4: 0x10023663f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 5: 0x100235b81 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 6: 0x100235220 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 7: 0x608f2a5be3d

我尝试升级软件包版本,包括webpack(我将其与WDS v3一起迁移到v4)。我发现this issue似乎也有同样的问题,但我无法解决。

这是完整的堆栈跟踪:

/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node[99538]: ../src/node_file.cc:943:void node::fs::Stat(const FunctionCallbackInfo<v8::Value> &): Assertion `(argc) == (4)' failed.
 1: 0x10003c597 node::Abort() [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 2: 0x10003b5b9 node::AddEnvironmentCleanupHook(v8::Isolate*, void (*)(void*), void*) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 3: 0x100071e70 node::fs::Stat(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 4: 0x10023663f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 5: 0x100235b81 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 6: 0x100235220 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/ryandrew/.nvm/versions/node/v10.15.3/bin/node]
 7: 0x608f2a5be3d

让我知道我可以在这里提供哪些帮助。

2 个答案:

答案 0 :(得分:0)

对我来说,解决方案是升级我的node-sass依赖项的版本。如果您遇到此问题,建议您检查所有软件包,以确保它们与您使用的新Node版本兼容。

答案 1 :(得分:0)

我遇到了同样的错误。并且花了很多时间来查找问题。

就我而言,将webpack-dev-middleware从2.x.x升级到3.x.x之后,问题就消失了。