-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Activating extension xxx failed: Module version mismatch. Expected 49, got 48.. #13143
Comments
@DonJayamanne assigning to you for now as I can not npm install this project without errors such as:
It seems you are using native modules as dependencies for the extension. That is very very dangerous because each time we update Electron, your extension will fail to execute. If possible, please replace native modules with a JS implementation. If that is not possible you will have to publish an update each time we bump Electron version and mark it compatible only with the version we updated to. It is expected that each time we update Electron the node.js version will change, so you will be broken roughly every other release. Now the error message is weird because it talks about version 49 and 48 (which I believe is node.js 4.x). We are shipping with node.js 6.5.0 which has a module version of 51. To be on the safe side for compilation you can use our npm.sh script that we use for VS Code (https://github.com/Microsoft/vscode/blob/master/scripts/npm.sh#L1) and configure it to electron 1.3.7. You can also use node.js 6.5.0 or later to install the dependencies. |
@bpasero , thanks will try that out |
@bpasero
I'll refactor the code such that the dependency is placed inside of a try catch using traditional
Will look into this.
I did install node.js 6.5.0 and then installing the dependencies, but that didn't work. I think it may have been the module version. @bpasero , two final queries:
|
@DonJayamanne looks like you are right, it is 49, at least in Electron. The source of proof always is here: electron/node@3ce8afa What number there is does not play an important role. The key take away is that every Electron update we do will require all native modules to be recompiled. Thus it is not practical to have such a dependency in extensions at all 👍 |
@bpasero , thanks
Agreed, but will need to go with the temporary approach for now. |
Supporting native C++ modules in Node.JS is one of the greatest feature of it and discouraging extension developers from using native modules is a slap in their face. It would be better if the ABI would stabilize finally, so that no module version bump is necessary. I'm affected by this issue as well, which is caused by the version bump in the electron/node fork. There is no official Node.JS version yet that uses 49, so it's impossible to recompile native modules for the current VS Code version, which is a PITA and really should not happen at all (for a tool in production use). I wonder how all the other extensions with native modules cope with such a situation, where any VS Code will likely break them (and there are quite a few). Please, don't just discourage extension developers, but find a way to avoid frequent node module version changes (or be more tolerant which node module version is accepted, if possible). Thank you. |
@mike-lischke take it easy, an aggressive tone in comments is not helpful and might discourage people from helping you. Of course you can compile native modules against VS Code. we ship with native modules in VS Code ourselves and make great use of C/C++ modules. The key is in the configuration of the We cannot keep any ABI compatibility, how would we? Electron is moving forward and so is node.js. Even if we decide to ship our own version of node.js, we would have to include all node.js versions we ever supported which is a pain to maintain and find issues. The best way for us is to move forward with Electron and node.js and make it clear for extension writers that native modules need to be updated when we update Electron. You can still do it, its just a bit more work for you to keep up to date. |
I'm sorry if my comment came across with a bad attitude. It's the result of reading that you apparently no longer want to encourage extension developer to use native modules just because it can be a pain to keep them up to date (you even commented it would be very dangerous). Actually, this is rather an Electron problem (and I filed a bug report there. However, in the meantime I learned that extension developers are supposed to compile against Electron's node.js variant. So far it appeared to me as if that was optional and so far it also worked for me to use the system node.js version for compiling my extension (well, except on Windows). What would help from your side is that you don't update Electron too often, but instead do this only in larger time frames (say once in 6 months) to avoid breaking extensions too often. That was mostly what I'd like to wish as a compromise. |
hi @mike-lischke , apologies for not getting back earlier.
I believe when it comes to extensions for VS Code it is best to try and avoid the use of native modules (where possible) for ease of maintenance and end user experience. |
It goes even further than that - if you use e.g. a linter and then through configuration that includes a binary module, that breaks too. (eg. xo-linter and import loader webpack resolver) I wish there was a way to fix this but I can't really think of anything :( |
Steps to Reproduce:
I also tried this with nodejs 4.6.0 and npm 3.10.7, and still get a similar message (
Activating extension
donjayamanne.pythonfailed: Module version mismatch. Expected 49, got 46..
).Error displayed:
The text was updated successfully, but these errors were encountered: