Content-Length: 320516 | pFad | https://github.com/npm/json-parse-even-better-errors/issues/3#issuecomment-1668728929

75 [BUG] `package-lock.json` double-spaced when `package.json` has a blank line after the opening brace · Issue #3 · npm/json-parse-even-better-errors · GitHub
Skip to content

[BUG] package-lock.json double-spaced when package.json has a blank line after the opening brace #3

Closed as not planned
@MattF-NSIDC

Description

@MattF-NSIDC

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When running npm install, the package-lock.json output is double-spaced when a blank line exists between the opening brace and the first key of package.json.

This package.json produces a double-spaced lockfile:

{

  "name": "test-doublespace",
  "dependencies": {
    "left-pad": "latest"
  }
}

and this one doesn't:

{
  "name": "test-doublespace",
  "dependencies": {
    "left-pad": "latest"
  }
}

The double-spaced lockfile looks like this all the way to the end:

{

  "name": "test-doublespace",

  "lockfileVersion": 2,

  "requires": true,

  "packages": {
<snip>

I've tried putting blank lines in other places, but have only been able to reproduce it with a blank line after the opening brace.

Expected Behavior

Blank lines are valid in JSON and are not considered to be "data", so I would expect any blank lines to have no impact on the locked data.

Steps To Reproduce

  1. Create a new empty directory
  2. Create a test `package.json
    echo '{
    
      "name": "test-doublespace",
      "dependencies": {
        "left-pad": "latest"
      }
    }' > package.json
    
  3. Run npm install
  4. View package-lock.json. It should be double-spaced!

Environment

  • npm: 8.19.2
  • Node.js: v16.17.1
  • OS Name: Ubuntu 20.04
  • System Model Name: Lemur Pro
  • npm config:
; "user" config from /home/mfisher/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /home/mfisher/.nvm/versions/node/v16.17.1/bin/node
; node version = v16.17.1
; npm local prefix = /tmp/foo
; npm version = 8.19.2
; cwd = /tmp/foo
; HOME = /home/mfisher
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/npm/json-parse-even-better-errors/issues/3#issuecomment-1668728929

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy