Max Koretskyi
Max Koretskyi

Reputation: 105449

grunt - what is correct installation process?

I have my project files in the directory /myproject. I want Grunt to build files into /myproject/www. Here is what I've done:

1) Opened command line in /myproject and run the following command: npm install -g grunt-cli
2) Opened command line in /myproject and run the following command: npm install grunt --save-dev
. This command downloaded a bunch of files and created the folder node_modules inside /myproject. Here is the structure of the node_modules: /myproject/node_modules/grunt/package.json.

If I create file Gruntfile.js inside /myproject/node_modules/grunt/ folder and run tasks from this folder, everything's OK. But I want to run tasks from the /myproject folder. So I moved Gruntfile.js and package.json files up from /myproject/node_modules/grunt/ to /myproject. However, when I run Grunt now I get the following error: >> Local Npm module "grunt-contrib-concat" not found. Is it installed? So what did I do wrong?

Upvotes: 0

Views: 64

Answers (1)

Jordan Kasper
Jordan Kasper

Reputation: 13273

You can't move files from /myproject/node_modules/grunt, those are for Grunt itself. You need to create new files in /myproject, a package.json file and a Gruntfile.js file. Then read the Grunt documentation to see how to configure Grunt. You'll need to add things like grunt-contrib-concat (or whatever other modules you want to use) to your package.json's "devDependencies": {} section as well as inside your Gruntfile.js. The documentation linked to above will have examples of the structure for both files.

Upvotes: 1

Related Questions