Marco Dinatsoli Marco Dinatsoli - 1 year ago 70
Node.js Question

node js add the required models

I am following this tutorial to add a web hook.

It's written to use this app

that app is a node js app.

in the app.js, there is this:

bodyParser = require('body-parser'),
config = require('config'),
crypto = require('crypto'),
express = require('express'),
https = require('https'),
request = require('request');

when i run the app like this:

node app.js

i get the following error:

throw err;

Error: Cannot find module 'body-parser'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\MyApps\messe
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)

how can I solve it please ?

Answer Source

Open terminal (or windows command line), go to messenger-platform-samples/node directory and install messenger-platform-samples by running this command:

npm install

after that you can run the app:

node app.js