Sam*_*ath 12 node.js typescript angular
42% 构建 274/275 个模块 1 个活动 ...\src\index.js??extracted!D:\Clients\app\node_modules\sass-loader\lib\loader.js??ref--15-3!D :\src\styles.scss <--- 最后几个 GC --->
[12996:000002DFC57D42F0] 43111个MS:扫气1335.4(1425.0) - > 1335.3(1426.0)MB,2.6 / 0.0毫秒(平均亩= 0.169,电流亩= 0.100)分配失败[12996:000002DFC57D42F0] 43489个MS:马克扫1336.2 (1426.0) -> 1335.4 (1425.5) MB,375.8 / 0.0 ms(平均 mu = 0.144,当前 mu = 0.100)分配失败清除可能不会成功
<--- JS 堆栈跟踪 --->
==== JS 堆栈跟踪 ==========================================
Run Code Online (Sandbox Code Playgroud)0: ExitFrame [pc: 00000257D3FDC5C1] Security context: 0x00b77541e6e9 <JSObject> 1: createNode [000001A31ED4EFF1] [D:\Clients\app\node_modules\typescript\lib\typescript.js:~16489][pc=00000257D55AD889](this=0x02b823cedf89 ,kind=275,pos=-=-1,end=-1) 2: createPropertyAssignment [000001A31ED54669] [D:\Clients\app\node_modules\typescript...
致命错误:堆限制附近的无效标记压缩分配失败 - JavaScript 堆内存不足 1:00007FF76C26DD8A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506 2:00007FF76C248886 node::MakeCallback+4572004 node::MakeCallback+4572004 node_C26DD8A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4504 00007FF76C5630DE v8::internal::FatalProcessOutOfMemory+846 5: 00007FF76C56300F v8::internal::FatalProcessOutOfMemory+639 6: 00007FF76C749804 v8::internal::07F1000Sc0::7F10000Sc0:000000000:000000000000000007FF76C56300F v8::internal::FatalProcessOutOfMemory+639 =+24550 8: 00007FF76C73EE3C v8::internal::ScavengeJob::operator=+17980 9: 00007FF76C747B87 v8::internal::Heap::MaxHeapGrowingFactor+2327 10: 00007FF76C747B87 v8::internal::Heap::MaxHeapGrowingFactor+2327 10: 00007FF76C747B87+2327 10: 0007::Heap14G24F3 apx4FMax 000787FMaxrow4G2F :00007FF76C871EA7 v8::internal::Factory::NewFillerObject+55 12:00007FF76C8EF096 v8::internal::运算符<<+73494 13:00000257D3FDC5C1
我试过这个解决方案:https : //github.com/angular/angular-cli/issues/5618#issuecomment-450151214
IE
包.json
"scripts": {
"ng": "ng",
"ng-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng",// here
"start": "ng serve",
"build:prod": "ng build --configuration=prod",
},
Run Code Online (Sandbox Code Playgroud)
在那之后
npm 运行 ng-high-memory --build --prod
但它说
Run Code Online (Sandbox Code Playgroud)> > metronic-angular@6.0.0 ng-high-memory D:\Clients\app > > node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng > > Available Commands: add Adds support for an external library to your > project. analytics Configures the gathering of Angular CLI usage > metrics. See https://v8.angular.io/cli/usage-analytics-gathering. > build (b) Compiles an Angular app into an output directory named dist/ > at the given output path. Must be executed from within a workspace > directory. deploy (d) Invokes the deploy builder for a specified > project or for the default project in the workspace. config > Retrieves or sets Angular configuration values in the angular.json > file for the workspace. doc (d) Opens the official Angular > documentation (angular.io) in a browser, and searches for a given > keyword. e2e (e) Builds and serves an Angular app, then runs > end-to-end tests using Protractor. generate (g) Generates and/or > modifies files based on a schematic. help Lists available commands > and their short descriptions. lint (l) Runs linting tools on Angular > app code in a given project folder. new (n) Creates a new workspace > and an initial Angular app. run Runs an Architect target with an > optional custom builder configuration defined in your project. serve > (s) Builds and serves your app, rebuilding on file changes. test (t) > Runs unit tests in a project. update Updates your application and > its dependencies. See https://update.angular.io/ version (v) Outputs > Angular CLI version. xi18n Extracts i18n messages from source code. > > For more detailed help run "ng [command name] --help"
那么我怎样才能正确运行这个命令呢?
注意:我使用最新的 Angular ie"@angular/core": "^8.2.14", and"@angular/cli": "^8.3.19",
Sam*_*ath 20
这对我有用:
我已经更新到最新的 Angular,如下所示: ng update @angular/cli@^8 @angular/core@^8
然后
包.json
"scripts": {
"ng-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --configuration=prod",
}
Run Code Online (Sandbox Code Playgroud)
在那之后:
npm run ng-high-memory
Run Code Online (Sandbox Code Playgroud)
网址: JavaScript 堆内存不足
您分配的内存不足。
在您的项目目录中,运行此命令。
set NODE_OPTIONS=--max_old_space_size=8192
Run Code Online (Sandbox Code Playgroud)
(这设置了分配的 8GB 内存)。
然后,
ng serve --open或者ng build --prod
或者像 这样使用,
set NODE_OPTIONS=--max_old_space_size=8192 & ng serve --open
Run Code Online (Sandbox Code Playgroud)
为了避免每次都一起输入所有这些内容,我们可以将此脚本保存在package.json文件中。
在“脚本”内 :{....}
"scripts": {
.....
"mserve":"set NODE_OPTIONS=--max_old_space_size=8192 & ng serve --open"
}
Run Code Online (Sandbox Code Playgroud)
然后在终端中的项目内。跑步
npm run mserve
Run Code Online (Sandbox Code Playgroud)
您可以将 mserve 重命名为您想要的任何名称
| 归档时间: |
|
| 查看次数: |
30325 次 |
| 最近记录: |