question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm shrinkwrap fix

See original GitHub issue

What is the current behaviour ?

Installing discord.js from NPM repository works but trying to use npm shrinkwrap you are required to install packages mentioned in peerDependencies and they are locked down in your tree. The result is a series of committed or non-committed packages added to your installation tree if you use npm shrinkwrap, a more tedious and error-prone process than installing discord.js with all peers and semantically equivalent.

What is the expected behaviour ?

You should be able to install discord.js as normal without the extra packages required for voice communication, sockets, etc. Immediately trying to shrinkwrap would still fail and point you to install the discord.js-extra (naming suggestions wanted) which contains the extra packages required in optionalDependencies.

A user requiring to shrinkwrap would have a dedicated paragraph in the README where the NPM documented default behaviour is given an example:

npm install -S discord.js node-opus
npm install discord.js-extra --no-optional
npm shrinkwrap

A user not requiring to shrinkwrap would follow current standard procedures since nobody wants breaking changes !

What changes does this issue involve ?

For a successful npm shrinkwrap to work with a random number of extra packages (as required) I could identify the following changes needed:

  • removing peerDependencies content in favour of discord.js-extra
  • creating and maintaining a discord.js-extra NPM package with current peerDependencies listed as optionalDependencies
  • amending the README with information on how to successfully run npm shrinkwrap

Please check this out @Gawdl3y @hydrabolt

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
Gawdl3ycommented, Mar 2, 2017

NPM has been, currently is, and at this rate, always will be garbage in some way/shape/form. There are various aspects of it that are fundamentally broken, and show no signs of improving any time in the near future. I have no interest in working around its deficiencies, especially when it complicates things that little bit more, for both us (the lib devs) and our users. Using peer dependencies is already “wrong”, and is simply a band-aid fix for NPM’s optional dependency support being absolute trash. “Fixing” shrinkwrap by moving the peer dependencies to a separate package really does very little to help anything. It potentially makes the life of the majority of the user base slightly more difficult, in order to support a feature of NPM that isn’t even commonly used. And best of all, you still won’t be able to use shrinkwrap if you want to use any of the optional packages (unless you manually ensure it is within the correct version range, and don’t install the theoretical discord.js-extra package).

And to respond to other things you mention:

  • You absolutely can use this framework with NPM, as 90% (or more) of our user base is doing. The others are using yarn, the slightly less terrible manager. Believe it or not, you are the first person ever to mention npm shrinkwrap that I’ve seen.
  • I’m very well aware of the importance of documentation, and I’ve always put large emphasis on it since I joined the project. The documentation is always being improved. I personally have been working on rewriting and adding more detail to significant portions of the it, though there is still loads more to be done. If you find areas that are lacking, you are free to submit a PR, or point it out to us.
  • I have no idea what you mean by “quirks” of the framework.
  • Your issue is not being dismissed, and your contribution is not being shunned. We appreciate that you want to improve the library. We simply disagree about the necessity of this change, and believe that the costs outweigh the benefits.
2reactions
meew0commented, Mar 2, 2017

(The above link is wrong, it should be https://yorkaargh.gitbooks.io/discord-js-bot-guide/)

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm-shrinkwrap
This command repurposes package-lock.json into a publishable npm-shrinkwrap.json or simply creates a new one. The file created and updated by this command ...
Read more >
Understanding NPM shrinkwrap - node.js - Stack Overflow
NPM shrinkwrap is used to lock the dependency version in a project. After installing packages using npm install or npm install package-name ...
Read more >
Managing Node.js Dependencies with Shrinkwrap
Run "npm shrinkwrap", add npm-shrinkwrap.json to git, and publish your package. To add or update a dependency in a shrinkwrapped package: Run " ......
Read more >
Dealing with NPM shrinkwrap merges and conflicts
First (assuming the conflict occurred during a rebase), we checkout the original shrinkwrap - abandoning our changes ( --ours somewhat ...
Read more >
uber-archive/npm-shrinkwrap: A consistent ... - GitHub
NPM shrinkwrap serializes your node_modules folder. Depending on whether you installed a module from cache or not it will either have or not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found