Skip to content
This repository was archived by the owner on Apr 11, 2020. It is now read-only.

npm install unnecessarily executed #357

Open
scottaddie opened this issue Jan 5, 2016 · 6 comments
Open

npm install unnecessarily executed #357

scottaddie opened this issue Jan 5, 2016 · 6 comments

Comments

@scottaddie
Copy link
Member

scottaddie commented Jan 5, 2016

In Visual Studio 2015 Update 1 (with ASP.NET 5 RC1 Update 1 tooling installed), I created a new app using the "StarterWeb" project template. I waited until all npm dependencies had been restored, and then I added a script to package.json:

"scripts": {
  "clean": "gulp clean"
}

The script being added really doesn't matter. I'm only providing an example for clarity.

After saving the package.json file, I saw the following appear in the "Bower/npm" view of the Output window:

====Executing command 'npm install'====


npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

====npm command completed with exit code 0==== 

I then added another script and saved the file. The same output appeared.

The npm install command should only be executing when I modify the dependencies or devDependencies properties of package.json. Is it possible to implement some sort of dirty checking on specific properties of this file?

@sayedihashimi
Copy link
Contributor

I don't think that's supported. @BillHiebert or @davidfowl how do users implement/extend clean?

@scottaddie
Copy link
Member Author

@sayedihashimi To be clear, I was just using the clean script as an example. Ideally, the npm install command would only run when the devDependencies or dependencies properties have changed. Is this something that can be supported in the near future?

@scottaddie
Copy link
Member Author

@sayedihashimi Here are a couple more problems which are closely related. When you create an ASP.NET 5 RC1 Update 1 StarterWeb app in VS 2015 Update 1, the following dependencies exist in the package.json file:

  "devDependencies": {
    "gulp": "3.8.11",
    "gulp-concat": "2.5.2",
    "gulp-cssmin": "0.1.7",
    "gulp-uglify": "1.2.0",
    "rimraf": "2.2.8"
  }

Problem 1
Manually delete one of the key-value pairs listed in the devDependencies section and save the file. I deleted "rimraf": "2.2.8", saved the file, and expected the rimraf module to be uninstalled via npm un -D rimraf. Instead what happened was the npm install command ran again, and this module stuck around in the node_modules folder.

npm install

Problem 2
Simply change the encoding type of package.json without making any changes in the file. Save it, and notice that npm install runs unnecessarily.

encoding change

@sayedihashimi
Copy link
Contributor

This is good feedback for @madskristensen assigned it to him

@sayedihashimi
Copy link
Contributor

TFS Bug#231184

@webtools-bot
Copy link

The GitHub Issue Tracker for the aspnet/Tooling repo is being deprecated in favor of Visual Studio's Report a Problem tool.

If this issue is still a problem with the RTW release of Visual Studio 2017, please report a new issue using the Report a Problem tool. While you can still use .NET Core and ASP.NET Preview tools with Visual Studio 2015, Visual Studio 2017 is now the officially supported tool for developing .NET Core and ASP.NET Core projects.

By using the Report a Problem tool (available in both VS 2017 and VS 2015), you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See Visual Studio's Talk to Us page for more details.

Please use the discussion topic here for feedback and questions on the deprecation of this issue tracker. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants