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

fix(install): Rebuild native modules when node version changes #4750

Merged
merged 2 commits into from
Oct 26, 2017

Conversation

romanschejbal
Copy link
Contributor

@romanschejbal romanschejbal commented Oct 20, 2017

Summary

Fixes #756. We have multiple versions of our app and each one uses a different version of node.
Therefore we need to rebuild our node-sass module every time we move from one to another.

This PR addresses that by saving the NODE version those artifacts were built with within the .yarn-integrity file and triggers forced scripts install (only if the node version is different ofc).

Test plan

1. Install Node.js 7.x
2. Add the node-sass dependency to the project via Yarn
3. Update Node.js to 8.x (new NODE_VERSION)
4. Run "yarn install" (you should see yarn downloading fresh scripts/binaries)

@buildsize
Copy link

buildsize bot commented Oct 20, 2017

This change will increase the build size from 9.94 MB to 9.94 MB, an increase of 1.26 KB (0%)

File name Previous Size New Size Change
yarn-[version].noarch.rpm 859.47 KB 859.54 KB 68 bytes (0%)
yarn-[version].js 3.78 MB 3.78 MB 438 bytes (0%)
yarn-legacy-[version].js 3.83 MB 3.83 MB 438 bytes (0%)
yarn-v[version].tar.gz 865.09 KB 865.22 KB 134 bytes (0%)
yarn_[version]all.deb 654.12 KB 654.32 KB 210 bytes (0%)

@BYK BYK requested a review from arcanis October 24, 2017 18:14
Copy link
Member

@arcanis arcanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Two small nits and we're good to go 👍

@@ -37,6 +38,7 @@ type IntegrityHashLocation = {
};

type IntegrityFile = {
node_version: string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodeVersion (camelcase :)

@@ -386,6 +393,7 @@ export default class InstallationIntegrityChecker {
integrityMatches: integrityMatches === 'OK',
integrityError: integrityMatches === 'OK' ? undefined : integrityMatches,
missingPatterns,
nodeVersionDoesntMatch: integrityMatches === 'NODE_VERSION_DOESNT_MATCH',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this to something more generic, like hardRefreshRequired?

@romanschejbal
Copy link
Contributor Author

@arcanis sure and done. Thanks for reviewing 👍 😊

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we exclude minor or patch versions from the refresh?

@BYK BYK changed the title Rebuild native modules when node version changes. Fixes #756 fix(install): Rebuild native modules when node version changes Oct 26, 2017
@BYK BYK merged commit 917713d into yarnpkg:master Oct 26, 2017
@aahoughton
Copy link

Maybe I'm something obvious, but I don't believe this solves my use-case for #756 -- build and package on one architecture, deploy and rebuild on another. I'm not worried about NODE_VERSION changing.

"Bad idea," sure, but npm handles this well.

joaolucasl pushed a commit to joaolucasl/yarn that referenced this pull request Oct 27, 2017
…kg#4750)

**Summary**

Fixes yarnpkg#756. We have multiple versions of our app and each one uses a different version of node. 
Therefore we need to rebuild our `node-sass` module every time we move from one to another. 

This PR addresses that by saving the NODE version those artifacts were built with within the `.yarn-integrity` file and triggers forced scripts install (only if the node version is different ofc).

**Test plan**

```
1. Install Node.js 7.x
2. Add the node-sass dependency to the project via Yarn
3. Update Node.js to 8.x (new NODE_VERSION)
4. Run "yarn install" (you should see yarn downloading fresh scripts/binaries)
```
@romanschejbal
Copy link
Contributor Author

romanschejbal commented Oct 31, 2017

@aahoughton what if Yarn stored the arch. as well and rebuild upon changes? Would that solve the issue you're having? Anyway, for now I'd wait for the next release and create a separate issue describing the different architectures problem (if that's still a thing) - feel free to ping me then and I'll give it a go.

Any thoughts on this ^ anyone - i.e. is that the right solution?

@aahoughton
Copy link

That would solve my issue, yes -- I'd just need to insure that the appropriate files are built into my deb. This is effectively the same logic as the version rebuild trigger, yes?

@aahoughton
Copy link

poke.

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

Successfully merging this pull request may close these issues.

5 participants