简体   繁体   English

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

[英]“not listed in package.json” , node.js while installing NTVS

在此输入图像描述

In the red box following status show for the modules.. can anyone help me.. Thanks advance 在以下状态显示模块的红色框中..任何人都可以帮助我..谢谢提前

Open up command prompt and cd into the project directory (you can right-click the project in Solution Explorer and choose Open command prompt from here... ). 打开命令提示符并进入项目目录(您可以在解决方案资源管理器中右键单击该项目,然后Open command prompt from here...选择Open command prompt from here... )。

Type npm init and fill in the fields when prompted (or hit Enter to take the default). 键入npm init并在提示时填写字段(或Enter以采用默认值)。 The output should look something like this... 输出应该看起来像这样......

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)

If for some reason npm init doesn't work, you can save the following text into a file called package.json in the root of your project and update the values to match the packages in your project. 如果由于某种原因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"
}

A third option is to delete the npm_modules folder in the project. 第三个选项是删除项目中的npm_modules文件夹。 Then you can right click on the npm "folder" in Solution Explorer, select Manage npm modules... , and reinstall the packages. 然后,您可以在解决方案资源Manage npm modules...器中右键单击npm “文件夹”,选择“ Manage npm modules... ,然后重新安装软件包。 Installing them this way should create a package.json for you. 以这种方式安装它们应该为您创建一个package.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM