How to prevent “npm install” change package.json


New Member
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


Thành viên BQT
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.

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Chủ Đề Xem Nhiều