Nodejs: Cannot find module 'passport'

I am missing something simple enough at the beginning of my research at Node.js. I am trying to create a small application using passport authentication.

I have the following line in app.ts:

import passport = require("passport");

and the following im my package.json:

{
    "name": "ftct",
    "version": "0.0.0",
    "description": "ftct",
    "main": "app.js",
    "author":
    {
        "name": "Mark.Norgate",
        "email": ""
    },
    "dependencies":
    {
        "express": "3.4.4",
        "jade": "*",
        "passport": "^0.3.2",
        "stylus": "*"
    }
}

However, Visual Studio 2015 complains:

Build: Cannot find module 'passport'.

What am I missing? I got a little familiar with the documentation for passport documents, but so far nothing indicates what could be the problem.

+4
source share
3 answers

Edit:

import passport = require("passport");

in

var passport = require("passport");
+2
source

package.json . npm install package.json, , - npm install <package name>. npm install passport.

npm install npm . / node_modules.

npm

+3

, package.json, .

, package.json

"engines": {
    "node": ">=6.9.1"
  },

package.json , , .

+1

Source: https://habr.com/ru/post/1616582/


All Articles