question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package.json is being modified after cordova build android

See original GitHub issue

Description: I work in a windows environment with vscode where all files need to end with CRLF , so this configs are made:

  • .editorconfig the end_of_line property is set to crlf
  • git uses crlf
  • .prettierrc has "endOfLine": "crlf"
  • vscode config has "files.eol": "\r\n" and "prettier.endOfLine": "crlf"

All work as expected except for when you build (or run) the project on device. > cordova build android the package.json file is edited and stripped from the last empty line. That leads git say changes where made and the tree is not clean.

Steps to Reproduce:

  • Make a clean cordova project (or if you use Ionic as I do, then an ionic empty project)
  • Set eol to crlf
  • Add platform Android
  • Make sure package.json has a empty new line in the end.
  • Run cordova build android

Output: image

I had this problem with cordova version 8.0.0 and right now with 8.1.2

Edit: As per this comment, this problem also happens in iOS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
arzyucommented, Sep 10, 2019

I created a plugin to solve this issue.

https://github.com/arzyu/cordova-plugin-package-json-guard

2reactions
jwhitmarshcommented, Jan 22, 2019

Affecting iOS too

Read more comments on GitHub >

github_iconTop Results From Across the Web

Phonegap 7 is messing with package.json - Stack Overflow
I have found a workaround to overcome this since it seems that we have to manually exclude the packages of cordova when building...
Read more >
Creating your first Cordova app
The Cordova command-line tool is distributed as an npm package. ... Run the following command to build the project for all platforms: $...
Read more >
Building a Tabris.js App - Tabris.js Documentation
Tabris.js utilizes Apache Cordova to build and package apps. ... app on your local machine, you need to setup developer tools like Xcode...
Read more >
Differentials - Appflow - Ionic.io
No, If the native build does not contain the manifest file, it is impossible for the deploy to know which files are already...
Read more >
Android App Development Guide - Ionic Framework
We don't recommend using Android Studio for developing Ionic apps. Instead, it should only really be used to build and run your apps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found