I am new to node.js, experts, please help. I am preparing code for user synchronization based on node.js + AWS Cognito + Facebook Login. I tried an example from this.
Each step runs smoothly, as long as the "facebook sing with with passport" section
var express = require('express');
var router = express.Router();
var passport = require('passport');
...
router.use(passport.initialize());
...
After adding this part in the example, I run "npm start", the following error appeared:
C:\workspace\nodejs\CognitoExample\routes\index.js:35
router.use(passport.initialize());
^
TypeError: Cannot read property 'use' of undefined
What does “Unable to read property” mean? How to solve a problem? Thanks in advance.
After a few experts help here, I can solve the problem:
Yesterday I used the npm install -g express-generator @ 3 command, so my global configuration expresses version 3. First I uninstall and install express.
npm uninstall -g express-generator@3
npm uninstall -g express
npm install -g express
npm install -g express-generator
1 , , express 3.x , , ,