WebStorm:模块未在package.json依赖项中列出 [英] WebStorm: Module is not listed in package.json dependencies

查看:919
本文介绍了WebStorm:模块未在package.json依赖项中列出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将NPM软件包Express导入WebStorm以使用以下方法使用它:

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;...

它通过以下消息强调表达. 该模块未在package.json依赖项中列出.

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

我在WebStorm方面没有太多经验,所以我不知道如何解决此问题.有人愿意解释吗?

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

推荐答案

将光标置于带下划线的单词上,按Alt + Enter,然后选择"Add 'express' to dependencies in package.json"(如果希望在dev中列出它,则选择"Add 'express' to devDependencies in package.json")依赖性)

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)

这篇关于WebStorm:模块未在package.json依赖项中列出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆