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

Plugin it's not looking for the node_modules in the same folder as the packages.json. #47

Closed
martuanez opened this issue Apr 1, 2016 · 6 comments

Comments

@martuanez
Copy link

When a custom path is given for the package.json the plugin is not able to find the node_modules folder

@sindresorhus
Copy link
Owner

What custom path are you giving it? Can you provide some code?

@martuanez
Copy link
Author

require('load-grunt-tasks')(grunt, {config: '../package.json'});

@sindresorhus
Copy link
Owner

Works for me.

@kahluagenie
Copy link

kahluagenie commented Apr 26, 2016

I think what @martuanez is saying is that when you give a custom package.json path, it doesn't look for node_modules at that file's level. It still looks at the default node_modules for the whole project. As an example, let's say my dependency is this Builder npm package. Builder depends on some grunt plugins that it loads by pointing to its own package.json:
require('load-grunt-tasks')(this.grunt, {config: Path.resolve(__dirname, 'package.json')});

Now let's assume I'm on npm2 (nested dependency dir structure). So when I bring in Builder as a dependency into my other project and invoke that code, it's still looking in the root node_modules for my project instead of looking at node_modules for that custom 'package.json' location. Which might be working as designed due to the nature of npm, but wasn't apparently obvious to me. I expected it to load out of that custom path, not just scan for dependencies in that package.json.

@martuanez
Copy link
Author

That's what I tried to explain

@adampetrie
Copy link

I came across this same issue - is this the intended behaviour? If so, what is the benefit of passing in a path to the package.json file?

denisbabineau pushed a commit to denisbabineau/load-grunt-config that referenced this issue Oct 19, 2018
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 a pull request may close this issue.

4 participants