madskristensen/PackageInstaller

package.json and package-lock.json are not updated if they are read-only

Opened this issue · 0 comments

Installed product versions

  • Visual Studio Enterprise 2015 Update 3
  • Package Installer 2.0.101

Description

When I install an npm package, Package Installer doesn't update package.json or package-lock.json if the files are read-only. The files are read-only because they are (TFS) source controlled and not checked out.

Steps to recreate

  1. Create a new web application
  2. Install an npm package so that the package.json and package-lock.json files are created.
  3. Check in the code to a TFS server, using a server workspace, including package.json and package-lock.json.
    At this point, package.json and package-lock.json are read-only.
  4. Try to install another npm package.

Current behavior

Packager Installer will download the npm package into node_modules, but package.json and package-lock.json are not updated.

Expected behavior

I expected Package Installer to check-out package.json and package-lock.json if they are source controlled.
If I open package.json and manually edit it in the Visual Studio IDE for example, it will automatically check-out the file, so I expected the same behavior.