cannot work with Gruntfile unless it is next to node_modules
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
I have a Gruntfile in a subdirectory.
I use `require('load-grunt-tasks')(grunt);` and I keep getting `Local Npm module "grunt-contrib-jshint" not found. Is it installed?` messages.
Looking at the code - the problem seems to be in loadNpmTask:
`var root = path.resolve('node_modules');`
perhaps changing it to the below will solve the problem
`var root = grunt.file.findup('node_modules');`
As a workaround I am using `--base` as suggested http://stackoverflow.com/a/20336077/1068746 but this looks more like a bug to me.
Contributor guide
Research direction
Start by locating the loadNpmTask code and reproduce the issue with a Gruntfile in a subdirectory while node_modules is elsewhere in the project. Compare the current node_modules lookup with the reported grunt.file.findup suggestion; done means local tasks such as grunt-contrib-jshint are found without requiring --base.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100