“package.json中未列出”,node.js安装NTVS

在这里输入图像说明

在红色框下面的模块状态显示..任何人都可以帮助我..感谢提前

打开命令提示符并进入项目目录(您可以右键单击解决scheme资源pipe理器中的项目,然后Open command prompt from here...select“ 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文件夹。 然后,你可以右键单击解决scheme资源Manage npm modules...器中的npm “文件夹”,select“ Manage npm modules... ,然后重新安装软件包。 以这种方式安装它们应该为你创build一个package.json