-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
NODE_PATH
does not work
#515
Comments
NODE_PATH
does not work with subdirectoriesNODE_PATH
does not work
Conclusion #4 from that article:
That said, not sure why this would not work. The |
I'm not super happy with the If it's a beginner-friendly issue, I'd be glad to help. |
I honestly don't know if it is. Feel free to give it a go. I would start by checking that neither this bit or |
I will give it a shot tomorrow, thanks for the pointers. |
I'm stuck with the same problem, @inyono did you find a workaround or the cause of this issue? |
I think I've got something, as @jamestalmage suggested inside test-worker.js module: module.constructor._nodeModulePaths = function () {
var ret = oldNodeModulesPaths.apply(this, arguments);
ret.push(nodeModulesDir);
return ret;
}; Seems like [ 'D:\\projects\\app\\node_modules\\babel-core\\node_modules',
'D:\\projects\\app\\node_modules',
'D:\\projects\\node_modules',
'D:\\node_modules',
'D:\\projects\\app\\node_modules\\ava\\node_modules' ] I tried naively to do this: module.constructor._nodeModulePaths = function () {
var ret = oldNodeModulesPaths.apply(this, arguments);
ret.push(nodeModulesDir);
if (process.env.NODE_PATH) {
const additionalPath = path.join(process.cwd(), process.env.NODE_PATH);
ret.push(additionalPath);
}
return ret;
}; But the problem is that A ugly solution could be to seth |
Yeah, I it works with absolute paths. Considering https://gist.github.com/branneman/8048520#6-the-hack, I looked into _initPaths(), but |
Seems like |
See PR. I found a fix that at least works in my minimal example. Because I have failing tests in both my branch and on master, I guess I did something wrong, though ;) |
I tried another approach, hope one of them could be merged :) |
We are using
NODE_PATH=.
in our app to improve localrequire()
. AVA (version 0.11.0) has problems with it, though.flat-file structure:
nested-file structure
The text was updated successfully, but these errors were encountered: