Unable to save a package.json file (Atom creates duplicates)


#1

I’m unsure why but when I try and update and save a package.json file in my project, I get the message:

“Atom Helper.app wants to make changes. Type your password to allow this”

Having entered the password, Atom complains:

Unable to save file - permission denied
'Path/to/package.json'

It then creates an additional package.json file but with a tilde on the end e.g. package.json~

Sublime edits the file and saves as expected! Any idea why Atom has this problem?


#2

I had the same issue with my package.json file after removing and reinitializing git in my directory.

Instead of changing your permissions, you can delete your current package.json file, and then run npm init in the terminal. This will generate a new package.json file under your current username and you’ll have permission to edit and save the file.

Hope that helps!