在红色框中显示模块的状态显示..任何人都可以帮助我..谢谢提前
答案 0 :(得分:3)
打开命令提示符并进入项目目录(您可以在解决方案资源管理器中右键单击该项目,然后选择Open command prompt from here...
)。
键入npm init
并在提示时填写字段(或点击Enter
以采用默认值)。输出应该看起来像这样......
C:\Anthony\Demo\ExpressApp1\ExpressApp1>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sane defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (ExpressApp1)
version: (0.0.0)
description:
entry point: (app.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Anthony\Demo\ExpressApp1\ExpressApp1\package.json:
{
"name": "ExpressApp1",
"version": "0.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"express": "~3.4.4",
"jade": "~1.1.5",
"stylus": "~0.42.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes)
如果由于某种原因npm init
不起作用,您可以将以下文本保存到项目根目录中名为package.json
的文件中,并更新值以匹配项目中的包。
{
"name": "ExpressApp1",
"version": "0.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"express": "~3.4.4",
"jade": "~1.1.5",
"stylus": "~0.42.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
第三个选项是删除项目中的npm_modules
文件夹。然后,您可以右键单击解决方案资源管理器中的npm
“文件夹”,选择Manage npm modules...
,然后重新安装软件包。以这种方式安装它们应该为您创建package.json
。