[Bug?]: Should be rebuilt after node version changes
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
All binary should be rebuilt after the node version is changed
To reproduce
$ nvm use 16
$ yarn add canvas
$ yarn node -e "require('canvas')"
$ echo $?
0
$ nvm use 12
$ yarn rebuild canvas
➤ YN0000: ┌ Link step
➤ YN0007: │ canvas@npm:2.8.0 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 0s 794ms
➤ YN0000: Done with warnings in 7s 253ms
$ yarn node -e "require('canvas')"
Error: The module '/Users/yuchao/Playgrounds/yarn-v3-test/.yarn/unplugged/canvas-npm-2.8.0-b8a304d4de/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.external_module_.Module._load (/Users/yuchao/Playgrounds/yarn-v3-test/.pnp.cjs:28198:14)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18) {
code: 'ERR_DLOPEN_FAILED'
}
$ echo $?
1
rm -rf /Users/yuchao/Playgrounds/yarn-v3-test/.yarn/unplugged/canvas-npm-2.8.0-b8a304d4de
$ yarn rebuild canvas
$ yarn node -e "require('canvas')"
$ echo $?
0
Environment
System: OS: macOS 10.15.7 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Binaries12: Node: 12.22.5 - /private/var/folders/x9/m_y2fpmn1wgcd33f1y0tdhgr0000gq/T/xfs-4176eca1/node Yarn: 3.0.1 - /private/var/folders/x9/m_y2fpmn1wgcd33f1y0tdhgr0000gq/T/xfs-4176eca1/yarn npm: 6.14.14 - ~/.nvm/versions/node/v12.22.5/bin/npm Binaries16: Node: 16.8.0 - /private/var/folders/x9/m_y2fpmn1wgcd33f1y0tdhgr0000gq/T/xfs-df11ae61/node Yarn: 3.0.1 - /private/var/folders/x9/m_y2fpmn1wgcd33f1y0tdhgr0000gq/T/xfs-df11ae61/yarn npm: 7.21.0 - ~/.nvm/versions/node/v16.8.0/bin/npm
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
How to rebuild node.js addon when source changes
I need to change something so that the rebuild (node-gyp step) will happen automatically when the source changes and then restart nicely.
Read more >Benefits - Appcircle
Catch bugs, errors, mistakes early. Don't worry that an unintended feature will get released to public. Increase confidence about your releases and release...
Read more >Supported Node versions - Node-RED
If you change the version of Node.js you are using, you may need to rebuild Node-RED's dependencies as well as any nodes you...
Read more >rollup.js
rollup.config.js import fetch from 'node-fetch'; export default ... not values, so values can be changed after they are initially imported as per this...
Read more >Announcing Meteor 2.3.1: Node 14, removal of deprecated ...
The first major change in Meteor 2.3 is Node version upgrade to Node ... This was a bug introduced after the addition of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@arcanis This message is confusing. Is it saying the package had to be built and was built? Because that’s not what this sentence says:
I understand it might be doing the building after remarking that it
must be builtbut that’s not at all clear from the message itself.This feels like a soft error when it should be written as a note:
Let me know if you’ll accept a PR to change this wording to avert confusion.
@arcanis Thanks you are right.