Skip to content

error invalid bin entry for package #613

Description

@samhstn

What / Why

I need to run: npm prune from this line in this Heroku buildpack: https://github.com/gjaldon/heroku-buildpack-phoenix-static/blob/master/lib/build.sh#L137

I experience the following error:

npm ERR! invalid bin entry for package jsesc@2.5.2. key=jsesc, value=bin/jsesc

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/samhstn/.npm/_logs/2019-12-18T17_08_55_527Z-debug.log

Which produced the following debug log: 2019-12-18T17_08_55_527Z-debug.log

When

The error only occurs when running npm prune when no node_modules are present and it can occur for more than just the jsesc module.

But npm prune works fine when we have installed our node_modules.

Where

The error occurs from a clean build on our Heroku ci and for me locally on my osx machine.

How

From cloning this repository: https://github.com/samhstn/invalid-bin-entry, then running:

cd assets
npm prune

produces the error


What should I do to debug this type of error going forward? And how can I get my Heroku buildpack to successfully run the npm prune command?

Activity

  1. nickv2002 commented on Dec 18, 2019

    @nickv2002

    I have a new and very similar and unexplained error in my packaging setup. Hoping for an answer here to clarify what's happening.

    This was one of the few places I could even find a reasonable result for:

    npm "invalid bin entry"

    Which makes me suspect this might be due to some recent change.

  2. grossmannmartin commented on Dec 18, 2019

    @grossmannmartin

    I experience the same issue

  3. PatrickQuintal commented on Dec 23, 2019

    @PatrickQuintal

    I'm experiencing the same error message, on NPM: v6.13.4.

    My steps to reproduce are different to OP, but I'm assuming its a similar cause.

    We use:
    npm ci && npm prune --production

    This causes
    error invalid bin entry for package

    Using:
    npm install && npm prune --production

    Works fine however. I would assume because npm install touches package-lock/package.json whenever it sees fit and is potentially adding something in there to make this all work.

    I've traced this back to
    npm/bin-links@25a34f9#diff-168726dbe96b3ce427e7fedce31bb0bcR85

    Which was added in the v6.13.3 npm release.

    I don't particularly understand whats going on right now. I might have a better read later to understand what the actual cause is rather then the symptom.

    We shouldn't revert to v6.13.2 as 6.13.3 & 6.13.4 are to resolve the bin security flaw;
    https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli

    I think the best course of action right now is to just not use prune until this gets sorted, most likely after the holiday period. :)
    @samhstn @grossmannmartin @nickv2002

    @isaacs (because git-blame tells me so 😂 )

  4. cam-sy commented on Dec 23, 2019

    @cam-sy

    Having the same issue. Seeing it with varying packages:

    + npm prune
    npm ERR! invalid bin entry for package portastic@1.0.1. key=portastic, value=bin/portastic
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2019-12-23T21_19_21_377Z-debug.log
    
  5. added a commit that references this issue on Dec 26, 2019
  6. isaacs commented on Dec 26, 2019

    @isaacs
    Contributor

    Yeah, looks like prune doesn't pass in the fully resolved folder when it links bins (which, I have to say, why is prune linking bins, that seems somewhat unnecessary, but ok.)

    It'll be fixed in the next cli release. In the meantime, you can maybe use npm ci --production to get to the state of "production deps installed, but not dev deps"? That won't be good if you're depending on bundling your deps in the git repo, of course, since ci throws away the existing node_modules if it finds one, but just trying to think of workarounds you might be able to use.

  7. added
    semver:patchsemver patch level for changes
    Release 6.xwork is associated with a specific npm 6 release
    on Dec 26, 2019
  8. astroash commented on Jan 3, 2020

    @astroash

    Any news on when this fix will be live?

  9. isaacs commented on Jan 3, 2020

    @isaacs
    Contributor

    6.13.5 will be going out tuesday of next week, 2019-01-07, with an update to pacote and bin-links to fix this and one other issue.

  10. javiermrz commented on Jan 7, 2020

    @javiermrz

    Same happening here. Do you know aproximately at what time it will be updated today?

  11. jwwtaker commented on Jan 7, 2020

    @jwwtaker

    This issue's been driving me nuts the last few days, is there any idea when the fix will go out? its broken all my auto deployments via TeamCity so we're stuck being able to deploy and QA our products.

  12. isaacs commented on Jan 8, 2020

    @isaacs
    Contributor

    Sorry for the delay. Been debugging a weird failure on GH Actions Windows CI. We expect to get this out in the next few days, at the longest.

  13. javiermrz commented on Jan 8, 2020

    @javiermrz

    @jwwtaker you can just use the commands in inverse order until the fix comes out:

    • npm install
    • npm prune
  14. samhstn commented on Jan 13, 2020

    @samhstn
    Author

    npm prune still not working for me using npm v6.13.6.

    From original description:

    From cloning this repository: https://github.com/samhstn/invalid-bin-entry, then running:

    cd assets
    npm prune

    produces the following error:

    npm ERR! invalid bin entry for package jsesc@2.5.2. key=jsesc, value=bin/jsesc
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/samhstn/.npm/_logs/2020-01-13T13_17_57_425Z-debug.log

    And the following debug log: 2020-01-13T13_17_57_425Z-debug.log

  15. 1 remaining item

  16. jazzzz commented on Jan 13, 2020

    @jazzzz

    We have the same problem but cannot use these workarounds because the commands are run by the Heroku buildpack. We are stuck at npm 6.13.2 (the issue happens since npm 6.13.3), or we must remove package-lock.json (the issue only happens with this file). npm 6.13.5 does not fix it, neither does npm 6.13.6.

  17. gregory commented on Jan 15, 2020

    @gregory

    any update on this @isaacs ?

  18. PabloFerroDev commented on Jan 16, 2020

    @PabloFerroDev

    My Azure DevOps CI was giving me the same error, so, just in case someone need help to temporarily fix this:

    • Add a new task in your pipeline before your npm prune or npm install called "Node.js tool installer"
    • Set 13.3.0 as in the "Version Spec" field and re-run.

    That worked for me.

  19. trusktr commented on Jan 26, 2020

    @trusktr

    Unlike some people above, updating from npm 6.13.4 to 6.13.6 fixed the issue in my case, so at least we know some problems were fixed. I hope it can be fixed for everyone else too.

    After 20 days, at least a progress update would be great.

  20. added a commit that references this issue on Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release 6.xwork is associated with a specific npm 6 releasesemver:patchsemver patch level for changes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo