npm run dev不运行脚本

时间:2020-06-13 21:50:51

标签: node.js npm webpack

我正在尝试在项目上运行npm run dev,但我一直遇到错误,但找不到答案。起初,我认为这是一个webpack错误,但是我已经卸载并重新安装,但仍然收到错误。我正在运行node.js v10,由于其他区域依赖v10,因此我无法更新到最新版本。

这是我试图运行的开发脚本

 "dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=webpack.config.js"

这是我最初的错误:

#
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
#
#
#
#FailureMessage Object: 000000EEFF5FA330npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! Ffrees@1.0.0 dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=webpack.config.js`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the Ffrees@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\joe6166\AppData\Roaming\npm-cache\_logs\2020-06-13T20_36_55_273Z-debug.log

但是现在我正在得到这个:

C:\Users\joe6166\code\UAccount>npm run dev
> Ffrees@1.0.0 dev C:\Users\joe6166\code\UAccount
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=webpack.config.js


<--- Last few GCs --->

[27056:0000023255CE98B0]   215447 ms: Mark-sweep 1345.6 (1442.9) -> 1330.1 (1439.9) MB, 750.4 / 0.0 ms  (average mu = 0.277, current mu = 0.262) allocation failure scavenge might not succeed
[27056:0000023255CE98B0]   215717 ms: Scavenge 1344.8 (1439.9) -> 1330.7 (1440.9) MB, 4.3 / 0.0 ms  (average mu = 0.277, current mu = 0.262) allocation failure


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 000000A16F1DC5C1]
    1: StubFrame [pc: 000000A16F1913E6]
Security context: 0x024cfb61e6c1 <JSObject>
    2: resolve [000001622EC02A61] [path.js:~133] [pc=000000A16FE7BE24](this=0x007738e82579 <Object map = 000002D088D38A71>)
    3: arguments adaptor frame: 1->0
    4: toNamespacedPath [000001622EC02BA1] [path.js:~609] [pc=000000A16FCD501C](this=0x007738e82579 <Object map = 000002D088D38A71>,path=0x03e132a8e6a1 <Very...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6EEE2879A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
 2: 00007FF6EEE03206 node::MakeCallback+4534
 3: 00007FF6EEE03B80 node_module_register+2032
 4: 00007FF6EF121AFE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF6EF121A2F v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF6EF308224 v8::internal::Heap::MaxHeapGrowingFactor+9620
 7: 00007FF6EF2FF206 v8::internal::ScavengeJob::operator=+24550
 8: 00007FF6EF2FD85C v8::internal::ScavengeJob::operator=+17980
 9: 00007FF6EF3065A7 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF6EF306626 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF6EF4308C7 v8::internal::Factory::NewFillerObject+55
12: 00007FF6EF4ADAB6 v8::internal::operator<<+73494
13: 000000A16F1DC5C1
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Ffrees@1.0.0 dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=webpack.config.js`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the Ffrees@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\joe6166\AppData\Roaming\npm-cache\_logs\2020-06-13T21_06_41_598Z-debug.log```



1 个答案:

答案 0 :(得分:0)

似乎是内存问题,请尝试node --max_old_space_size=64,但这可能仅适用于v8。