5

I have a Maven project where I execute npm install in build with the com.github.eirslett frontend-maven-plugin plugin.

My problem is that after the build, git says me that the package.json has been changed, although when I check the diff (in IntelliJ) it says Contents are identical. If i run stat package.json I see that all timestamps of the file have been changed.

How can I avoid npm install changing the package.json file?

Solution: See answer from James Monger

Elio
  • 428
  • 3
  • 20

1 Answers1

2

You can make a .gitattributes file in your project root with the following contents:

package.json text eol=lf
package-lock.json text eol=lf

That will specify that package.json and package-lock.json should always use LF file endings.

James Monger
  • 10,181
  • 7
  • 62
  • 98