yarn rebuild (Feature request)

Npm has npm rebuild to rebuild compiled packages (eg, node-sass). we need this in yarn for, among other reasons, the need to rebuild packages for cross-platform environments.

#2069 was closed prematurely and calls to reopen it have been ignored. it was closed after being erroneously marked as a duplicate. the use case and solution for #756 are quite different, and does not solve the problem.

Author: Fantashit

3 thoughts on “yarn rebuild (Feature request)

  1. I’d still love to see this functionality added.

    For anyone who runs across this in the meantime, npm rebuild --update-binary appears to be a viable workaround that won’t mess with your lock files. /ht @fugroup

  2. yarn rebuild is still needed for using workspaces. npm rebuild --update-binary will only work for the top-level dependencies and not workspace deps.

Comments are closed.

7 thoughts on “yarn rebuild (Feature request)

  1. Our use-case for this: Copying a project into a docker container which doesn’t have permissions to pull all of our packages. A rebuild is required. (And npm rebuild seems to error on the node_modules left by yarn for some reason.)

  2. Occasionally I have issues after switching environments around that are solved by an npm rebuild. It’s one of the few tasks I still have to rely on npm for currently.

  3. @BYK please reopen this issue. The other issue resolves in context of node version changing. We need an actual rebuild package command for cross-platform considerations.

  4. Is there a workaround?

    Depends on what your core problem is

    Looking at all the comments at the topic, I think something like most of people – I changed node version and needed to rebuild node-sass. I managed to do that by using yarn install --force.

  5. I used npm rebuild --update-binary to resolve my issues. It doesn’t create a package-lock file either so it shouldn’t interfere with yarn.

  6. I recently upgraded from node 8.x to 10.x and I had to rebuild bcrypt. I noticed that when I ran yarn right away without --force flag, it would still rebuild the said package (and a few others that also had to be built). The process lasted for about a minute.
    Though afterwards when I tried to launch the application, it said that the bcrypt package was still built against node 8.x. I tried doing yarn --force but it didn’t even seem to be rebuilding at all (as in, the whole process only took about a second, as opposed to taking almost a minute with regular rebuilding). I ran the application once again just to make sure, but as expected it returned the error about wrong node version.

    Either way, I finally did npm rebuild --update-binary which @fugroup suggested and it finally rebuilt the package against the correct node version.

Comments are closed.