好吧,我有一个用 Next.js 制作的网络应用程序。该项目在本地主机上功能齐全,但是当我尝试构建因为我想在 Netlify 上托管它时,它给了我以下奇怪的错误:
$ next build
info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
[ ===] info - Generating static pages (2/8) 1: 00007FF7D5C73E0F napi_wrap+108911
2: 00007FF7D5C17E16 v8::base::CPU::has_sse+61910
3: 00007FF7D5C18D16 node::OnFatalError+294
4: 00007FF7D5C184F9 v8::base::CPU::has_sse+63673
5: 00007FF7D5C4194C napi_fatal_error+156
6: 00007FF830D01E69
7: 00007FF830D15771
8: 00007FF830D1F843
9: 00007FF830D1F7CE
10: 00007FF7D5C50796 node::Stop+36310
11: 00007FF7D649DDCF v8::internal::Builtins::builtin_handle+321711
12: 00007FF7D649CFFC v8::internal::Builtins::builtin_handle+318172
13: 00007FF7D649D642 v8::internal::Builtins::builtin_handle+319778
14: 00007FF7D649D4A3 v8::internal::Builtins::builtin_handle+319363
00007[ ==] info - Generating static pages (2/8)FF7D6579C8D v8::internal::SetupIsolateDelegate::SetupHeap+465453
16: 00007FF7D650DF71 v8::internal::SetupIsolateDelegate::SetupHeap+23825
17: 00007FF7D65F8733 v8::internal::SetupIsolateDelegate::SetupHeap+984275
18: 00007FF7D6512092 v8::internal::SetupIsolateDelegate::SetupHeap+40498
19: 00007FF7D650BCC9 v8::internal::SetupIsolateDelegate::SetupHeap+14953
1209[ =] info - Generating static pages (2/8)2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
21: 00007FF7D65BA3F0 v8::internal::SetupIsolateDelegate::SetupHeap+729488
22: 00007FF7D650DF9A v8::internal::SetupIsolateDelegate::SetupHeap+23866
23: 00007FF7D65F8733 v8::internal::SetupIsolateDelegate::SetupHeap+984275
92 v[ ] info - Generating static pages (2/8)8::internal::SetupIsolateDelegate::SetupHeap+40498
25: 00007FF7D650BCC9 v8::internal::SetupIsolateDelegate::SetupHeap+14953
sola[ =] info - Generating static pages (2/8)teDelegate::SetupHeap+40498
27: 00007FF7D653F2C0 v8::internal::SetupIsolateDelegate::SetupHeap+225376
28: 00007FF7D65BBE1E v8::internal::SetupIsolateDelegate::SetupHeap+736190
29: 00007FF7D653233D v8::internal::SetupIsolateDelegate::SetupHeap+172253
30: 00007FF7D650FC3C v8::internal::SetupIsolateDelegate::SetupHeap+31196
31: 00007FF7D63DFB7F v8::internal::Execution::CallWasm+1839
32: 00007FF7D63DFC8B v8::internal::Execution::CallWasm+2107
33: 00007FF7D63E06CA v8::internal::Execution::TryCall+378
: [ ==] info - Generating static pages (2/8)00007FF7D63C0CE5 v8::internal::MicrotaskQueue::RunMicrotasks+501
35: 00007FF7D63C0A40 v8::internal::MicrotaskQueue::PerformCheckpoint+32
36: 00007FF7D5CA0B40 node::CallbackScope::~CallbackScope+672
37: 00007FF7D5CA08D4 node::CallbackScope::~CallbackScope+52
38: 00007FF7D5C3F5C6 node_module_register+2662
39: 00007FF7D5CD4C60 uv_timer_stop+560
40: 00007FF7D5CD4D37 uv_timer_stop+775
41: 00007FF7D5CD152B uv_async_send+331
42: 00007FF7D5CD0CBC uv_loop_init+1292
[====] info - Generating static pages (2/8)D5CD0E5A uv_run+202
44: 00007FF7D5B5B04C v8::internal::wasm::SignatureMap::Freeze+35292
45: 00007FF7D5B56B28 v8::internal::wasm::SignatureMap::Freeze+17592
46: 00007FF7D5CC165D uv_poll_stop+557
47: 00007FF7D6A888F0 v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+283808
[=== ] info - Generating static pages (2/8)C87C24 BaseThreadInitThunk+20
49: 00007FF86F64D721 RtlUserThreadStart+33
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
当我尝试使用 npm run build
命令时发生同样的错误。已经尝试删除node_modules,删除yarn.lock,yarn install但错误仍然相同(仅在此项目上)。
我有 Node v14.17.0 LTS、npm 6.14.13 和 yarn 1.22.5。这是我的 package.json 文件内容:
{
"name": "laptops",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"next": "10.1.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"sqlite": "^4.0.21",
"sqlite3": "^5.0.2"
},
"devDependencies": {
"@types/node": "^14.14.41",
"@types/react": "^17.0.3",
"typescript": "^4.2.4"
}
}
这可能是 Node 的问题,但我不知道如何解决这个问题。