node 编译遇到 Exit status 137问题解决

问题描述

在虚拟机执行npm run build执行打包文件时候一直失败,然而在windows上就没有这个问题

解决途径

  • 加上管理员权限 sudo npm run build
  • google找到两篇解决方案(npm ERR! weird error 137, npm install fails on Digital Ocean Ubuntu)

    其中关键引用:

    ① I’m getting this now. I’m fairly certain it’s because the server is running out of available memory.Gonna bump up my droplet from 2GB to 4GB and give this another go.Update: yep, this was down to lack of memory. I’m guessing that @wingchi rebooting freed up some memory and so that was why it fixed his issue.

    ② You need more ram. See all the closed issues about digital ocean for moredetails.

    ③ The problem is not with the unzipping, the problem is that we need RAM to store the complete data structure in memory at all times in order for geoip to do fast lookups. If we do not store this in memory, then lookups become slower because we’ll keep going to disk to read the file.

    ④ Alternative is to run the update on a bigger machine and then push the data files to all the servers needing the update.

    简而言之就是:你需要更多的内存

    之前我给CPU分配的内存是512M,改成1024就可以正常编译了

你可能感兴趣的:(react)