Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.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
Gruntjs grunt-什么是正确的安装过程?_Gruntjs - Fatal编程技术网

Gruntjs grunt-什么是正确的安装过程?

Gruntjs grunt-什么是正确的安装过程?,gruntjs,Gruntjs,我的项目文件在目录/myproject中。我想Grunt将文件构建到/myproject/www中。以下是我所做的: 1) 在/myproject中打开命令行并运行以下命令:npm安装-g grunt cli 2) 在/myproject中打开命令行并运行以下命令:npm install grunt--save dev。此命令下载了一组文件,并在/myproject中创建了文件夹节点\u modules。下面是节点模块的结构:/myproject/node\u modules/grunt/pac

我的项目文件在目录
/myproject
中。我想
Grunt
将文件构建到
/myproject/www
中。以下是我所做的:

1) 在
/myproject
中打开命令行并运行以下命令:
npm安装-g grunt cli

2) 在
/myproject
中打开命令行并运行以下命令:
npm install grunt--save dev

。此命令下载了一组文件,并在
/myproject
中创建了文件夹
节点\u modules
。下面是
节点模块的结构:
/myproject/node\u modules/grunt/package.json

如果我在
/myproject/node\u modules/grunt/
文件夹中创建文件
grunfile.js
,并从该文件夹运行任务,则一切正常。但是我想从
/myproject
文件夹运行任务。因此,我将Gruntfile.js和package.json文件从
/myproject/node\u modules/grunt/
移动到
/myproject
。但是,当我运行
Grunt
时,现在我得到以下错误:
>未找到本地Npm模块“Grunt contrib concat”。是否已安装?

那么我做错了什么呢?

您不能从
/myproject/node\u modules/grunt
移动文件,这些文件是为grunt本身准备的。您需要在
/myproject
中创建新文件、一个
package.json
文件和一个
grunfile.js
文件。然后阅读以了解如何配置Grunt。您需要在
package.json
“devdependency”:{}
部分以及
Gruntfile.js
内部添加
grunt contrib concat(或任何您想要使用的其他模块)之类的内容。与上面链接的文档将包含两个文件的结构示例