Skip to content

[BUG] package.json and package-lock.json order is different when used Czech locale #2829

Closed

Description

@jakubjosef

Current Behavior:

package-lock and package.json order is different when used non English (Czech) locale

Expected Behavior:

Sorting should be locale-agnostic to not change package-lock JSON back and forth.

Steps To Reproduce:

  1. Clone repo created with English locale
  2. Run npm install
  3. I see different order for packages with ch in name (eg. chai)

Environment:

  • OS: macOS 11.2.2
  • Node: 14.16.0
  • npm: 7.6.1

It looks like similar problem as it's reported here
npm/npm#17048

I think the root cause is different order of letters. In Czech alphabet CH letter stands after H, but in English alphabet it's just C.

Example in package.json (left is Czech locale, right is English)

image

Workaround

If someone is facing the same issue in can be fixed by defining alias alias npm='LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" npm' in bash_profile/.zshrc or similar file depends to shell you are using.

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 7.xwork is associated with a specific npm 7 release
    on Mar 5, 2021
  2. added
    Priority 2secondary priority issue
    and removed
    Needs Triageneeds review for next steps
    on Apr 9, 2021
  3. padinko commented on May 4, 2021

    @padinko

    same in Windows 10 with Slovak language, node v14.16.1, npm v7.11.2
    i can't find workaround for windows

  4. padinko commented on May 5, 2021

    @padinko

    I make pull requests to fix this

    npm/arborist#276 will fix sorting in package.json
    isaacs/json-stringify-nice#5 will fix sorting in package-lock.json

    so this 2 packeses will need to be updated to fix this

  5. wraithgar commented on May 5, 2021

    @wraithgar
    Contributor

    Thank you @padinko!

  6. self-assigned this
    on May 5, 2021
  7. jakubjosef commented on Jul 28, 2021

    @jakubjosef
    Author

    I can confirm this is now fixed in NPM. Thank you, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 2secondary priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions