[英]“not listed in package.json” , node.js while installing NTVS
在以下状态显示模块的红色框中..任何人都可以帮助我..谢谢提前
打开命令提示符并进入项目目录(您可以在解决方案资源管理器中右键单击该项目,然后Open command prompt from here...
选择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
文件夹。 然后,您可以在解决方案资源Manage npm modules...
器中右键单击npm
“文件夹”,选择“ Manage npm modules...
,然后重新安装软件包。 以这种方式安装它们应该为您创建一个package.json
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.