giodamelio
giodamelio

Reputation: 5605

Weird Cloudfoundry error

I have a simple node app that I am trying to host on cloudfoundry. I am using the node module srand.

When I visit the url, I get this error.

Error: Cannot find module './build/default/srand.node'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/var/vcap/data/dea/apps/UnfoundedAccusations-0-8f4d453d8731dd95a14f10aeddc17eae/app/node_modules/srand/index.js:4:20)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)

Upvotes: 0

Views: 248

Answers (2)

vinayr
vinayr

Reputation: 11234

Recently cloudfoundry made some changes for Node.js modules support. Have a look at here http://blog.cloudfoundry.com/2012/12/19/recent-changes-in-node-js-modules-support/

Upvotes: 2

Dan Higham
Dan Higham

Reputation: 3984

You have probably installed the module globally, which is fine for local development but you need to deploy the application with the module.

Before deploying via vmc, run npm install in the project directory.

Upvotes: 0

Related Questions