Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use npm in Visual studio 2017 without project.json file?

Now that they removed project.json in Visual Studio 2017, but npm used to install packages in the devDependencies in that file, how do we use npm to install packages now? If I create a package.json file, wouldn't that be redundant considering the existing MyProject.csproj file?

like image 487
ClaireL Avatar asked Mar 16 '17 21:03

ClaireL


People also ask

Does npm need package json?

The package. json file is the heart of any Node project. It records important metadata about a project which is required before publishing to NPM, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package.

How do I run npm in Visual Studio?

To open the package manager, from Solution Explorer, right-click the npm node in your project. Next, you can search for npm packages, select one, and install by selecting Install Package.

Does npm install automatically add to json?

By default, npm install will install all modules listed as dependencies in package. json . With the --production flag (or when the NODE_ENV environment variable is set to production ), npm will not install modules listed in devDependencies .

Why is npm in package json?

All npm packages contain a file, usually in the project root, called package. json - this file holds various metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.


1 Answers

When you install library via terminal and click on dependencies in the solution project, you can see that library will be marked as extraneous.

Extraneous means a package is installed but is not listed in your project's package.json

So use package.json if you want to install packages.

like image 119
A. Lipnitskiy Avatar answered Jan 02 '23 11:01

A. Lipnitskiy