Node.js : Error: Cannot find module 'restify'

4,308 views
Skip to first unread message

Thomas Amsler

unread,
Jul 20, 2012, 6:04:35 PM7/20/12
to appfog...@googlegroups.com
When I try to deploy my node.js application, I am getting the following error:

Starting Application 'appname': ..........................
Error: Application [appname] failed to start, logs information below.

====> /logs/stderr.log <====


node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module 'restify'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/mnt/var/vcap.local/dea/apps/polling-0-5cb7ac89c6f1199fad15c0a9f6837490/app/app.js:5:15)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)

Does the node service allow for npm modules deployment as they are defined in package.json?

Lucas Carlson

unread,
Jul 20, 2012, 6:36:44 PM7/20/12
to appfog...@googlegroups.com
Hi Thomas,

Did you run npm install within your directory before you ran af push?

-Lucas

Thomas Amsler

unread,
Jul 20, 2012, 6:45:33 PM7/20/12
to appfog...@googlegroups.com
Yep, I forgot to do an initial "npm install". Thank you.

Now I am getting the following error:

Starting Application 'appname': ..........................
Error: Application [appname] failed to start, logs information below.

====> /logs/stdout.log <====

[Error: Unable to load shared library /mnt/var/vcap.local/dea/apps/appname-0-588d6da3ffab589b17c50ab4cfec3636/app/node_modules/restify/node_modules/dtrace-provider/build/Release/DTraceProviderBindings.node]
appname listening at http://0.0.0.0:8080

-- Thomas

Lucas Carlson

unread,
Jul 20, 2012, 6:53:47 PM7/20/12
to appfog...@googlegroups.com
Hi Thomas,

You need to specify an environmental variable to set the port. Here is an example:

app.listen( process.env.VCAP_APP_PORT || 8080 );

-Lucas

Thomas Amsler

unread,
Jul 20, 2012, 7:05:27 PM7/20/12
to appfog...@googlegroups.com
That worked perfectly. Thank you very much for your help.

Best,
-- Thomas
Reply all
Reply to author
Forward
0 new messages