Marco Dinatsoli Marco Dinatsoli - 5 months ago 20
Node.js Question

node js add the required models

I am following this https://developers.facebook.com/docs/messenger-platform/quickstart tutorial to add a web hook.

It's written to use this app https://github.com/fbsamples/messenger-platform-samples

that app is a node js app.

in the app.js, there is this:

const
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:

module.js:327
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
nger-platform-samples-master\node\app.js:14:16)
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

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
Comments