Is there an existing issue for this?
Current Behavior
NPM 7 fails with an EACCES error when npm install is run with a package.json that:
- does not have a new line at the end, AND
- the user does not have the permission to write to the
package.json.
It most likely happens because of npm/npm#18545
NPM 6 does not fail like this.
Expected Behavior
I would expect npm install to work even with only read permissions to package.json.
The EOF new line has no meaning there, everything should work fine without it (on most systems), NPM does not really need to write to the package.json so read rights should be enough to execute npm install.
NPM 6 most likely does not fail, because it runs with higher privileges and writes the EOF even if the permissions on the package.json prevent it, but that's a different issue.
Steps To Reproduce
npm init -y
- remove EOF new line from
package.json
chmod 444 package.json
npm i
- NPM 7 fails with EACCES, NPM 6 keeps going
Environment
- OS: MacOs, various Linuxes
- Node: 15, 16
- npm: 7
Is there an existing issue for this?
Current Behavior
NPM 7 fails with an EACCES error when
npm installis run with apackage.jsonthat:package.json.It most likely happens because of npm/npm#18545
NPM 6 does not fail like this.
Expected Behavior
I would expect
npm installto work even with only read permissions topackage.json.The EOF new line has no meaning there, everything should work fine without it (on most systems), NPM does not really need to write to the
package.jsonso read rights should be enough to executenpm install.NPM 6 most likely does not fail, because it runs with higher privileges and writes the EOF even if the permissions on the
package.jsonprevent it, but that's a different issue.Steps To Reproduce
npm init -ypackage.jsonchmod 444 package.jsonnpm iEnvironment