生命周期是什么意思?

这是我的应用程序代码:https://gist.github.com/samholmes/388ca4552c5936b52c5d

当我运行'blast-电子邮件'命令时,它会运行一段时间,直到很快崩溃并出现错误:

npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "/root/.nvm/versions/io.js/v1.6.1/bin/iojs" "/root/.nvm/versions/io.js/v1.6.1/bin/npm" "run" "live"
npm ERR! node v1.6.1
npm ERR! npm  v2.7.1
npm ERR! code ELIFECYCLE
npm ERR! emailer@0.0.0 live: `NODE_ENV=production node app.js`
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the emailer@0.0.0 live script 'NODE_ENV=production node app.js'.
npm ERR! This is most likely a problem with the emailer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production node app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls emailer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /apps/emailer/npm-debug.log

npm-debug.log文件也包含在gist中。

我正在寻找两个答案中的一个:生命周期是什么意思?(或)为什么我在我的应用程序代码中得到错误?


当前回答

在我安装新包或更新它们后,我有同样的错误:

...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
...

它帮助我再次或多次运行安装命令。 之后,错误消失了。

其他回答

首先,你必须删除npm缓存并升级到节点的最新版本,npm将解决这个问题。

sudo npm cache clean -f

sudo npm install -g n install n 

sudo n stable 

第一个命令将强制清理npm包管理器的缓存,在第二个和第三个命令之后,将安装一个稳定版本的节点和npm。然后你可以执行NPM I和NPM run build来创建一个优化的产品版本。

这个解决方案适用于nextjs中npm run build命令的相同错误。

在我的例子中,当我从另一个目录复制项目时,我产生了类似的错误。一些隐藏的文件,如关键的.babelrc,丢失了。所以啊…确保你复制了所有的文件! :)

当我在节点docker容器内运行npm run build时,我有相同的错误代码。

在本地,它正在工作,而在容器内,我设置了选项,在编译期间有警告时抛出错误,而在本地它没有设置。所以这个错误可以指任何与停止NPM正在执行的进程有关的错误

如果你在ubuntu上运行,请检查你的nodejs版本。请将版本更新到最新,清除缓存,重新安装模块(npm install)并构建。

或以其他方式

请升级内存大小,然后重试。肯定会有用的。

同样,我认为这个错误是RAM太小的结果。我加大了虚拟机的RAM,错误消失了。