-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
[windows only] Require fails to load native addons with path longer than 260 characters #2964
Comments
It's probably best to keep with how long paths are handled for non-addons (e.g. use Module._extensions['.node'] = function (module, filename) {
return process.dlopen(module, path._makeLong(filename));
}; |
@mscdex Oh beautiful 😄 I didn't know about that function. That does appear to do what I need. |
Isn't this fixed by #2965? |
Yup, forgot to come back and close this. Thanks. |
Hi, I'm having the same issue and I can't manage to fix it ... When I try to launch a basic
In the index.js it's only the If you have any ideas... I'm stuck in this since 2 days >< |
@MattiooFR Which version are you using? The proposed fix landed in v4.2.0 only |
@thefourtheye Node v4.2.1 64 bit |
If you don't mind can you please translate
|
Oh for sure ! @thefourtheye
What's weird is that it's fully working on my other computer, I just copy the folder, I don't try to recompile, and with the new one when I try to EDIT : OK, my bad, some drivers were missing, now everything works 👍 |
For future reference, this error can occur when loading a module that has dependencies on other modules that are not found. On windows you can use this tool to look at your dependencies and see which is not loading properly: |
For a more authoritative discussion on this when people have future questions: https://www.youtube.com/watch?v=lpa2OFauASM found via @mousetraps & https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#max_path-explanation-and-workarounds |
I'm having trouble where somewhere down the line a dependency of mine is attempting to load a native addon. Due to deep nesting the process of requiring this addon fails with the error "The filename or extension is too long".
However, I found that I am able to work around this by modifying the global
Module
to always prepend"\\\\?\\"
to paths when attempting to load native addons.This works because paths with that funky prefix kicks win32 path handling into extended-length path mode, according to MSDN:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#short_vs._long_names
My workaround looks like this basically:
It appears to allow me to successfully load any native addon now, regardless of path length. I'm thinking of submitting a PR which would patch lib/module.js#L355 to essentially have this same functionality.
What do you think? Are there any gotcha's or can anyone think of a reason why this wouldn't work in the general case?
The text was updated successfully, but these errors were encountered: