0

我尝试了很多但无法找到原因。需要帮忙。以下是我在 Heroku 中部署我的第一个节点应用程序并且我的数据库位于 MongoLab 后所写的内容

heroku ps:scale worker=1 

它给了我以下错误。

!    No such type as worker.

我的 Procfile 看起来像这样,

web: node server/server.js

这是我的日志文件的样子

2013-04-20T21:12:31.474207+00:00 app[worker.1]:     at startup (node.js:119:16)
2013-04-20T21:12:31.474207+00:00 app[worker.1]:     at node.js:901:3
2013-04-20T21:12:32.710713+00:00 heroku[worker.1]: Process exited with status 8
2013-04-20T21:12:32.722040+00:00 heroku[worker.1]: State changed from starting to crashed
2013-04-20T21:18:02.281651+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-20T21:18:03.317730+00:00 heroku[web.1]: Starting process with command `node server/server.js`
2013-04-20T21:18:04.034486+00:00 app[web.1]:                               ^
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2013-04-20T21:18:04.034486+00:00 app[web.1]:     server = module.exports = express();
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-04-20T21:18:04.038104+00:00 app[web.1]: TypeError: object is not a function
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2013-04-20T21:18:04.034486+00:00 app[web.1]: 
2013-04-20T21:18:04.034486+00:00 app[web.1]: /app/server/server.js:7
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at Object.<anonymous> (/app/server/server.js:7:31)
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at startup (node.js:119:16)
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2013-04-20T21:18:04.038104+00:00 app[web.1]:     at node.js:901:3
2013-04-20T21:18:05.153193+00:00 heroku[web.1]: Process exited with status 8
2013-04-20T21:18:05.191971+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-20T21:18:31.948831+00:00 heroku[slugc]: Slug compilation started
2013-04-20T21:19:03.195879+00:00 heroku[worker.1]: State changed from crashed to down
2013-04-20T21:19:03.215823+00:00 heroku[api]: Release v13 created by suchak.maulik179@gmail.com
2013-04-20T21:19:03.254953+00:00 heroku[api]: Deploy 425df46 by suchak.maulik179@gmail.com
2013-04-20T21:19:03.326499+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-20T21:19:04.350726+00:00 heroku[web.1]: Starting process with command `node server/server.js`
2013-04-20T21:19:04.372088+00:00 heroku[slugc]: Slug compilation finished
2013-04-20T21:19:05.332176+00:00 app[web.1]: /app/server/server.js:7
2013-04-20T21:19:05.332477+00:00 app[web.1]:     server = module.exports = express();
2013-04-20T21:19:05.332529+00:00 app[web.1]:                               ^
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at startup (node.js:119:16)
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at node.js:901:3
2013-04-20T21:19:05.339486+00:00 app[web.1]: TypeError: object is not a function
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at Object.<anonymous> (/app/server/server.js:7:31)
2013-04-20T21:19:05.332176+00:00 app[web.1]: 
2013-04-20T21:19:05.339486+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-04-20T21:19:07.836462+00:00 heroku[web.1]: Process exited with status 8
2013-04-20T21:19:07.850902+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-20T21:27:35.413670+00:00 heroku[api]: Add NODE_ENV config by suchak.maulik179@gmail.com
2013-04-20T21:27:35.455828+00:00 heroku[api]: Release v14 created by suchak.maulik179@gmail.com
2013-04-20T21:27:35.590387+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-20T21:27:36.402134+00:00 heroku[web.1]: Starting process with command `node server/server.js`
2013-04-20T21:27:37.096860+00:00 app[web.1]:     server = module.exports = express();
2013-04-20T21:27:37.095996+00:00 app[web.1]: 
2013-04-20T21:27:37.096542+00:00 app[web.1]: /app/server/server.js:7
2013-04-20T21:27:37.101585+00:00 app[web.1]: TypeError: object is not a function
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2013-04-20T21:27:37.097188+00:00 app[web.1]:                               ^
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at Object.<anonymous> (/app/server/server.js:7:31)
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at startup (node.js:119:16)
2013-04-20T21:27:37.101585+00:00 app[web.1]:     at node.js:901:3
2013-04-20T21:27:38.325688+00:00 heroku[web.1]: Process exited with status 8
2013-04-20T21:27:38.337228+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-20T21:28:09.438921+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-20T21:28:10.370904+00:00 heroku[web.1]: Starting process with command `node server/server.js`
2013-04-20T21:28:10.983155+00:00 app[web.1]: /app/server/server.js:7
2013-04-20T21:28:10.983538+00:00 app[web.1]:     server = module.exports = express();
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at startup (node.js:119:16)
2013-04-20T21:28:10.987593+00:00 app[web.1]: TypeError: object is not a function
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at Function.Module.runMain (module.js:497:10)
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at Object.<anonymous> (/app/server/server.js:7:31)
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at node.js:901:3
2013-04-20T21:28:10.982954+00:00 app[web.1]: 
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2013-04-20T21:28:10.983538+00:00 app[web.1]:                               ^
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-04-20T21:28:10.987593+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-04-20T21:28:12.065391+00:00 heroku[web.1]: Process exited with status 8
2013-04-20T21:28:12.076681+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-20T21:29:48.836778+00:00 heroku[slugc]: Slug compilation started
2013-04-20T21:29:50.389288+00:00 heroku[slugc]: Slug compilation failed: failed to compile Node.js app
2013-04-20T21:31:17.189885+00:00 heroku[slugc]: Slug compilation started
2013-04-20T21:31:36.095712+00:00 heroku[api]: Release v15 created by suchak.maulik179@gmail.com
2013-04-20T21:31:36.130855+00:00 heroku[api]: Deploy 5c9dcf7 by suchak.maulik179@gmail.com
2013-04-20T21:31:36.321819+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-20T21:31:36.560503+00:00 heroku[slugc]: Slug compilation finished
2013-04-20T21:31:39.217666+00:00 heroku[web.1]: Starting process with command `node server/server.js`
2013-04-20T21:31:39.952499+00:00 app[web.1]: /app/server/server.js:7
2013-04-20T21:31:39.953143+00:00 app[web.1]:                               ^
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at Module._compile (module.js:449:26)
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at process.startup.processNextTick.process._tickCallback (node.js:244:9)
2013-04-20T21:31:39.952499+00:00 app[web.1]: 
2013-04-20T21:31:39.952832+00:00 app[web.1]:     server = module.exports = express();
2013-04-20T21:31:39.955817+00:00 app[web.1]: TypeError: object is not a function
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:467:10)
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at Module.runMain (module.js:492:10)
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at Object.<anonymous> (/app/server/server.js:7:31)
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-04-20T21:31:39.955817+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-04-20T21:31:41.158365+00:00 heroku[web.1]: Process exited with status 1
2013-04-20T21:31:41.168511+00:00 heroku[web.1]: State changed from starting to crashed    
4

1 回答 1

3

您正在运行的命令正在尝试将worker进程数扩大到 1,但您只声明了一个web进程类型。如果您试图扩大您将使用的 Web 进程的数量heroku ps:scale web=1。如果您尝试创建一个新的工作进程,则需要在 procfile 中定义一个工作进程并在尝试扩展之前推送到 Heroku(worker: node server/worker.js)。Heroku 关于进程类型的文档也应该有所帮助。

于 2013-04-21T16:16:17.503 回答