0

I try to work on a yeoman project with a team. After generating the angularjs code with > yo angular and pushed the folder to github

git add .
git push
git commit origin master

and when I clone the code from git github I have this error

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. For more information about installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

so I deleted every thing from .gitignore and pushed everything again, I had this warning

The file will have its original line endings in your working directory.

So I am quite sure it's not going to work and it's not the best way to do it. Can someone help me on how to upload the yeoman project ?

user567
  • 3,712
  • 9
  • 47
  • 80

2 Answers2

2

First of all, i think you have a typo in your question, you have mixed commit and push commands:

 git add .
 git commit -m 'commit message' // message is optional
 git push origin master

First message appears because you don't have an installed Grunt. Install it in your working directory:

npm install grunt --save-dev

Starting with Grunt v0.4, you should never install Grunt itself globally. For more information about why, please read this. Source: grunt-cli docs.

If it is alredy listed in the devDependencies, just run:

npm install

The second one is caused by line-endings. It is a good practice to include .gitattributes file in your repo. File's content should be:

* text=auto

Read about this file: docs. Or there is another method. It is described in this question.

Community
  • 1
  • 1
sobolevn
  • 16,714
  • 6
  • 62
  • 60
2

I think that angular generator for Yeoman already creates a package.json file with grunt defined as dependency along with all its task. So the correct way to compile a project after the clone is to install all npm dependencies locally using:

npm install

then run grunt to compile everything:

grunt

Of course you must have grunt-cli globally installed, which is used to run grunt locally. To install it you have to use the following command where -g defined the global install (default is local):

npm install -g grunt-cli
Alerosa
  • 568
  • 1
  • 5
  • 14