Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn rebuild (Feature request) #2069

Closed
rstacruz opened this issue Nov 29, 2016 · 17 comments
Closed

yarn rebuild (Feature request) #2069

rstacruz opened this issue Nov 29, 2016 · 17 comments

Comments

@rstacruz
Copy link

rstacruz commented Nov 29, 2016

Npm has npm rebuild to rebuild compiled packages (eg, node-sass). It would be nice if yarn had this, too.


Edit: Hi! If you came here looking for a solution, yarn --force will rebuild packages. Thanks @loziniak!

@alanhogan
Copy link

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.)

@rstacruz
Copy link
Author

rstacruz commented Feb 3, 2017

possibly related: #756

@joshrickert
Copy link

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.

@ghost
Copy link

ghost commented Jun 15, 2017

fyi, with

yarn --version
	0.24.5
node -v
	v8.1.2
npm -v
	5.0.3

after

yarn add --dev node-sass ...

exec of

npm rebuild node-sass

fails with

> [email protected] install /dev/www/yarn-test/node_modules/node-sass
> node scripts/install.js

module.js:487
    throw err;
    ^

Error: Cannot find module '/dev/www/yarn-test/node_modules/node-sass/scripts/install.js'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-06-15T17_14_17_946Z-debug.log

but checking, the file does exist

ls /dev/www/yarn-test/node_modules/node-sass/scripts/install.js
	/dev/www/yarn-test/node_modules/node-sass/scripts/install.js

@olalonde
Copy link

Dupe of #756

@BYK
Copy link
Member

BYK commented Oct 26, 2017

Closing in favor of #756.

@ctcpip
Copy link

ctcpip commented Oct 26, 2017

@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.

@aahoughton
Copy link

Agreed, as commented in #4750.

@giggio
Copy link

giggio commented Nov 1, 2017

Yes, those are different requests. This should be reopened.

@loziniak
Copy link

Is there a workaround?

@aahoughton
Copy link

Depends on what your core problem is -- there is no equivalent for npm rebuild due to architecture changes, which is a use case a number of us have. The npm rebuild due to node version changes fix is what -- possibly mistakenly -- lead to this issue being closed.

@BYK can we get confirmation that this issue won't be re-opened, and we should file a new one?

@loziniak
Copy link

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.

@shaunc
Copy link

shaunc commented Dec 24, 2017

I have a docker image that I build in stages, first excluding dev dependencies; later installing and building tests (finally, if tests run, taking original node_modules for production.). For test install, I need to use npm rebuild sass. Other than that, I could leave out npm from my image entirely...

@eldoy
Copy link

eldoy commented Aug 30, 2018

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.

@BobbyWibowo
Copy link

BobbyWibowo commented Nov 24, 2018

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.

@masaeedu
Copy link

@loziniak doesn't seem like yarn install --force does anything. I had to rebuild the platform-folders module after upgrading my Node JS version, but couldn't find any way to do this using Yarn (only after I used npm rebuild as @BobbyWibowo shows above did it work). Not sure why this issue and the "closed in favor of" issue are both closed.

@masaeedu
Copy link

For visibility, I found: #5271, which is what I guess folks trying to use Yarn with xplat modules need to keep an eye on.

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

No branches or pull requests