Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js “本地Npm模块”;GRUNT-PLUGIN-MODULE“;没有找到。安装了吗?什么';是什么原因造成的?_Node.js_Gruntjs_Npm_Grunt Plugins - Fatal编程技术网

Node.js “本地Npm模块”;GRUNT-PLUGIN-MODULE“;没有找到。安装了吗?什么';是什么原因造成的?

Node.js “本地Npm模块”;GRUNT-PLUGIN-MODULE“;没有找到。安装了吗?什么';是什么原因造成的?,node.js,gruntjs,npm,grunt-plugins,Node.js,Gruntjs,Npm,Grunt Plugins,如何将新的grunt插件模块加载到项目中 dir结构的示例: |-- abc-project | |-- ... | |-- app.js | |-- Gruntfile.js --> `grunt.loadNpmTasks('my-grunt-plugin');` | \-- package.json | \-- my-grunt-plugin |-- grunt-tasks | |-- task-a.j

如何将新的grunt插件模块加载到项目中

dir结构的示例:

|-- 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
      \-- ...
  • mygrunt插件中运行
    npm-link
    命令
  • 通过运行
    abc项目中的
    npm link my grunt plugin
    命令链接本地grunt插件模块
  • 运行
    grunt任务-a
    命令,它将记录
    本地Npm模块“我的grunt插件”未找到。是否已安装?

本例中的问题是
我的grunt插件中的任务目录名。

您需要确保task dir的名称始终为
tasks
而不是
grunt tasks

在我的项目(任何任务)上运行
grunt
时,我会遇到同样的错误。它似乎刚刚开始出现。我看到
未找到本地Npm模块“grunt插件”。安装了吗?
在我的
节点\u模块中有一个
grunt插件
文件夹。我尝试了从该文件夹中删除npm链接,也尝试了删除该文件夹。这对我来说很有效,尽管我似乎有不同的问题(请参阅我对该问题的评论)。简单地做了一个
mkdir节点\u modules/grunt plugin/tasks
,我再也看不到警告了!奇怪,但很高兴它修好了。