我试图将我的应用程序投入Sails.js的生产环境,但无法通过繁重的任务。这是我收到的错误:无法将Sails.js应用程序投入生产
error: Error: The hook `grunt` is taking too long to load.
Make sure it is triggering its `initialize()` callback, or else set
`sails.config.grunt._hookTimeout to a higher value (currently 20000)
at tooLong [as _onTimeout]
(/usr/local/lib/node_modules/sails/lib/app/private/loadHooks.js:92:21)
at Timer.listOnTimeout (timers.js:110:15)
我有大幅提升sails.config.grunt._hookTimeout
仍然过程尚未完成。在生产或开发的输出运行sails debug
:
Grunt :: Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Agent.Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at Agent.Server.listen (net.js:1267:5)
at Object.start (_debugger_agent.js:20:9)
at startup (node.js:86:9)
at node.js:814:3
我觉得很奇怪,在开发模式下,一切工作正常,但它不是在生产的情况。包含的文件非常大,如角度,时刻和其他模块。这是jsFilesToInject
的样子:
var jsFilesToInject = [
// Load sails.io before everything else
'js/dependencies/sails.io.js',
'js/dependencies/angular.min.js',
'js/dependencies/moment.min.js',
'js/dependencies/angular-ui-router.min.js',
'js/dependencies/angular-sails.min.js',
'js/dependencies/angular-moment.min.js',
'js/dependencies/angular-animate.min.js',
'js/dependencies/angular-aria.min.js',
'js/dependencies/angular-material.min.js',
// All of the rest of your client-side js files
// will be injected here in no particular order.
'js/**/*.js'
];
我不知道还有什么会导致此,有什么建议?我使用的版本扬帆0.11.0
您使用什么端口进行生产?如果它是80端口,看看是否有其他服务使用它(nginx,apache等)并杀死它们。同样值得尝试以root身份提升sails以查找它是否与权限相关。 – galactocalypse
我以root身份运行,并在端口443上运行SSL。无论如何,它仍然无法使用80。没有安装apache或nginx。 –
尝试运行grunt uglify:dist本身 – joncodo