Search code examples
node.jsexpresswebstorm

WebStorm: Module is not listed in package.json dependencies


I have tried importing the NPM package Express into WebStorm to use it using the following method: https://www.jetbrains.com/webstorm/help/installing-and-removing-external-software-using-node-package-manager.html#d89772e236

Although I have followed the steps, when I use my code:

var express = require("express");
var url = require("url");
var http = require("http");
var app;...

It underlines express, with the following message: Module is not listed in package.json dependencies.

I do not have that much experience with WebStorm, so I do not know how to fix this. Would anyone care to explain?


Solution

  • Put cursor on underlined word, hit Alt+Enter, choose 'Add 'express' to dependencies in package.json' (or 'Add 'express' to devDependencies in package.json' if you prefer to have it listed in dev dependencies)