Local Npm module "GRUNT-PLUGIN-MODULE" not found. Is it installed? What's causing this?

409 Views Asked by At

How to load your new grunt-plugin module to your project.

example of dir structure:

|-- abc-project
|       |-- ...
|       |-- app.js
|       |-- Gruntfile.js --> `grunt.loadNpmTasks('my-grunt-plugin');`
|       \-- package.json
|
\-- my-grunt-plugin
      |-- grunt-tasks
      |       |-- task-a.js --> `grunt.registerTask('task-a', 'running task a', function() { ... });`
      |       \-- task-b.js
      \-- ...
  • run npm link command inside my-grunt-plugin dir.
  • link your local grunt plugin module by running npm link my-grunt-plugin command inside abc-project dir.
  • run grunt task-a command, it will log Local Npm module "my-grunt-plugin" not found. Is it installed?
1

There are 1 best solutions below

1
Shadi Abu Hilal On

The issue in this case is the task dir name in the my-grunt-plugin. You need to make sure that the name of task dir is always tasks NOT grunt-tasks.