I’m new to node.js, experts, please help.
I’m preparing a code to do user sync based on node.js + AWS Cognito + Facebook Login. I tried an example from this link.
Every step runs smooth until “facebook sing in with passport” section
var express = require('express');
var router = express.Router();
var passport = require('passport');
After adding this part in the example, I run “npm start”, the following error appeared:
TypeError: Cannot read property 'use' of undefined
What’s the meaning of “Cannot read property”? How to fix the problem?
Thank in advance.
After few experts help here, I can solve the problem:
- re-install express
I used npm install -g [email protected] command yesterday, so it make my global setting to express version 3. I uninstall and install express again first.
npm uninstall -g [email protected]
npm uninstall -g express
npm install -g express
npm install -g express-generator
- Remove local node_modules
After step 1, same problem is still exist, I found that i installed express 3.x in local working folder before, so I create a new working folder, restart the example code again, problem is gone