AppelDonut
AppelDonut

Reputation: 73

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?

Upvotes: 7

Views: 13802

Answers (2)

BertC
BertC

Reputation: 2676

Or you have a typo in Package.json.

In that case the rest of the code gives this error for all modules.

Upvotes: 0

lena
lena

Reputation: 93908

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)

Upvotes: 12

Related Questions