简体   繁体   中英

“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... ).

Type npm init and fill in the fields when prompted (or hit Enter to take the default). 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.

{
  "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. Then you can right click on the npm "folder" in Solution Explorer, select Manage npm modules... , and reinstall the packages. Installing them this way should create a package.json for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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