角度通用运行成功。但是在数字海洋ubuntu os上运行实时服务器时出错

时间:2019-07-07 16:59:08

标签: linux angular digital-ocean angular-universal angular-cli-v6

我在angular 6应用程序中使用了通用角度。我通过“ npm run build:prod”在本地运行服务器,然后构建成功。当我尝试在实时服务器上运行构建时,我获得了“在优化资产优化SourceMapDevToolPlugin main.js后生成SourceMapKilled的92%”。我在问题上挣扎了很长时间。谁能提出建议

Angular 6,angular cli 6.2.9,数字海洋上的ubuntu,服务器块的nginix

suriyashop@suriya-shopping-droplet:/var/www/suriyashopping.com/html$ sudo npm run build:prod

> suriya-shopping@0.0.0 build:prod /var/www/suriyashopping.com/html
> npm run build:server:prod && npm run build:browser:prod


> suriya-shopping@0.0.0 build:server:prod /var/www/suriyashopping.com/html
> ng run suriyaShopping:server && webpack --config webpack.server.config.js --progress --colors

 92% after chunk asset optimization SourceMapDevToolPlugin main.js generate SourceMapKilled
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! suriya-shopping@0.0.0 build:server:prod: `ng run suriyaShopping:server && webpack --config webpack.server.config.js --progress --colors`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the suriya-shopping@0.0.0 build:server:prod 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!     /home/suriyashop/.npm/_logs/2019-07-07T16_57_52_188Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! suriya-shopping@0.0.0 build:prod: `npm run build:server:prod && npm run build:browser:prod`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the suriya-shopping@0.0.0 build:prod 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!     /home/suriyashop/.npm/_logs/2019-07-07T16_57_52_245Z-debug.log

直到今天我才遇到问题,以前一切正常

1 个答案:

答案 0 :(得分:0)

这可能是内存问题,请尝试使用以下命令提高nodejs的内存限制

node --max-old-space-size=4096 node_modules/@angular/cli/bin/ng run ...

不只是

ng run

此外,如果您处于生产模式,您是否真的需要源地图?您可以在angular.json文件中将其禁用