Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting grunt.js to work on a pre-existing yeoman project

I have a working yeoman project, which I run the server with grunt server, it works fine.

I put the entire thing into a git repo, and checked it out to a new folder...

when I try doing 'grunt server' it says:

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt hasn't been installed locally to your project.

I am having trouble getting grunt installed locally to that directory, and being able to locate and use the GruntFile.

like image 949
Scott Sporeganic Hedstrom Avatar asked Feb 28 '13 22:02

Scott Sporeganic Hedstrom


People also ask

How do I start a Grunt project?

Assuming that the Grunt CLI has been installed and that the project has already been configured with a package.json and a Gruntfile, it's very easy to start working with Grunt: Change to the project's root directory. Install project dependencies with npm install. Run Grunt with grunt.

Can I run grunt from any folder in my project?

Because of this, you can run grunt from any subfolder in your project. If a locally installed Grunt is found, the CLI loads the local installation of the Grunt library, applies the configuration from your Gruntfile, and executes any tasks you've requested for it to run.

What is Grunt JS and how does it work?

If you work in a team environment that means you can work with a set of unified commands and everyone will share a common workflow. Grunt.js uses power of Node.js to work and it runs from your command line. All the configuration is done in regular Javascript (or CoffeeScript).

What are the advantages of yeoman?

It allows for rapidly getting started on new projects and streamlines the maintenance of existing projects. Yeoman is language agnostic. It can generate projects in any language (Web, Java, Python, C#, etc.) Yeoman by itself doesn’t make any decisions.


2 Answers

After you check out a Yeoman project, you need to install the npm modules and bower components like you did after the initial scaffolding process, as they are not part of the git repository:

npm install & bower install
like image 143
passy Avatar answered Nov 15 '22 08:11

passy


I just ran into this today!

By default your .gitignore will be ignoring /bower_components, node_modules, dist folder, etc.

When you pull the project from git, just be sure to run npm install, and bower install, and you should be good to go after that!

like image 20
Chava Sobreyra Avatar answered Nov 15 '22 08:11

Chava Sobreyra