生命周期是什么意思?

这是我的应用程序代码: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中。

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


当前回答

以我为例,这是因为RAM内存较低,照片压缩库无法处理较大的照片。

其他回答

对我来说,这是一个三元命题:

它在抱怨这一行,尤其是分号:

let num_coin = val.num_coin ? val.num_coin || 2;

我把它改成:

let num_coin = val.num_coin || 2;

我在运行两个具有相同设置的项目时遇到了这个问题,而我已经运行了一个。这意味着其他项目不能使用该端口号。当我停止运行其他项目时,我没有遇到任何问题。

at process._tickCallback (internal/process/next_tick.js:10
4:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ng-contact-manager@0.0.0 sample: `node src/server/dat
a/seed-db.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng-contact-manager@0.0.0 sample script.
npm ERR! This is probably not a problem with npm. There is lik
ely additional logging output above.

npm ERR! A complete log of this run can be found in:

我有同样的问题,我是如何解决的最终! 错误: 当我运行NPM运行样例时,我的错误来自终端 在纠正我的数据库连接用户名和密码后 我正在使用mlab作为我的数据库,在文件.env下,我忘记正确地输入用户名和密码。当我纠正时,我工作了。

> ng-contact-manager@0.0.0 sample /Users/mohammedr.kemal/Downl
oads/Ex_Files_ANGULAR_API_AUTH/Exercise Files/Ch01/01_04/start
> node src/server/data/seed-db.js

connected to mongodb...
connected to mongodb...
2 records inserted.
closing connection...
done.
12 records inserted.
closing connection...
done.

因此,如果我们在代码中创建了数据连接,最好查看一下。

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

当在WordPress主题上工作时,我得到了相同的ELIFECYCLE错误,输出略有不同:

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/7.6.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.6.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! foundationsix@1.0.0 postinstall: `bower install && gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the foundationsix@1.0.0 postinstall script 'bower install && gulp build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the foundationsix package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower install && gulp build

在再次尝试npm install后,我又尝试了bower install。当这是成功的,我尝试了gulp构建,这也工作。

现在一切都很好。不知道为什么在&&失败的情况下分别运行每个命令,但也许其他人会发现这个答案很有用。