grunt build and grunt serve - node.js

When running grunt build and grunt serve the following warning is coming :
Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work.
Use --force to continue.
Aborted due to warnings.
grunt version:
grunt-cli v0.1.13
grunt v0.4.5
Operating System:
Windows 7
How to resolve this warning ? Is Ruby and Compass are required or without these I can proceed ?

It depends on your Gruntfile, probably you have to install ruby and compass to execute your tasks.
To install ruby in Windows you need to download the installer in RubyInstaller for Windows. Do not forget to open the installer as a administrator.
Then, to install compass you need sass and compass. Try it:
gem install sass
gem install compass
It should be fix your problem.

Try to install the follwing packages with NPM
npm install grunt-contrib-sass ruby grunt-sass sass -g
If this doesn't work try installing Ruby on your environment.

Related

'cmd' - not able to get the `grunt` version

I have installed the grunt using this command : npm install -g grunt-cli after i installed i am trying to fetch the grunt version using this command :
grunt --version - But i am not getting any output. what is the issue here? do i require to set the env variable or something?
please help me.
You would need to install Grunt globally as admin. Grunt docs recommend to use sudo when installing. This would be recommended for any Grunt or Gulp plugins you are installing globally. Run the same command npm install -g grunt-cli in admin command line then try grunt --version once more.
I'd recommend posting a separate question for the grunt processing as that involves much more functionality. A good example on a sample gruntfile can be found at Sample Gruntfile and includes processing js and html files for various tasks.
Let me know if that helps.
Thanks!

I'm cloning a repo with Yeoman, what configuration do I need on my computer?

I have cloned a repo that has Yeoman installed.
I installed node, as well as Yeoman npm i -g yo. When I run grunt I get an error stating:
Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.
What else do I need to do to be able to run this repo successfully?
The first time, you have to run npm install.
This will install all the needed dependencies as described in the package.json
Subsequently, if anyone add a new dependency into this file, you will need to run npm install or npm update again.
Actually besides npm, you should also download bower dependencies.
So it's 2-step:
npm install
bower install
If you don't invoke bower application may launch, but later you may encounter problems such as the lack of libraries.

grunt init:node not working

I'm trying to do an intro grunt tutorial. I've installed git, node.js, and grunt globally (or at least I thought I did using: npm install -g grunt (which installs). I then made a quick directory and entered it (mkdir demo, cd demo), but when I type:
> grunt init:node
at the prompt I get the following:
grunt-cli: The grunt command line interface (v0.1.11)
Fatal error: unable to find local grunt
If you're seeing this message, either a Gruntfile wasn't found or 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
Which I've looked at and it says to do what I'm doing and what the tutorial mentions??? Any ideas what I've done wrong? Node.js and Git have been working fine so I can only assume it is grunt or the install that has failed.
Thanks
with grunt you need two elements. a global grunt-cli as you have installed using npm install -g grunt-cli and also a local (to the project) copy of grunt itself. so in the folder of your project install this with npm install grunt --saveDev this will install a local grunt and also add it to your devDependencies in your package.json file. you will also need a Gruntfile.js in the project folder. This is a great write-up http://www.integralist.co.uk/Grunt-Boilerplate.html

Yeoman for Angular, then "grunt serve" won't start

This is the first time I use yeoman to setup the scaffolding for an AngularJS app, and I have to admit I am likely new to the nodeJS, grunt and bower world.
So, here's what I've done so far:
I made sure yeoman, grunt-cli and the angular-generator packages are installed
npm install -g yo grunt-cli bower
npm install -g generator-angular
Generated my app
yo angular
I also tried:
yo angular --min-safe
So far, al seems good. Between the options given, I choose the Twitter Bootstrap one, no angular dependencies, and to overwrite my local .gitignore file.
After all that, I try to run my app:
grunt serve
At this point, grunt complains that it is not locally installed into the project, so I run:
npm install grunt --save-dev
No again, trying to run the app:
grunt serve
And this is where I get blocked:
C:\Projects\what-now>grunt serve
Running "serve" task
Running "clean:server" (clean) task
Running "concurrent:server" (concurrent) task
Running "copy:styles" (copy) task
Done, without errors.
Warning:
C:\Projects\what-now\node_modules\grunt-contrib-compass\node_modules\tmp\lib\tmp.js:261
throw err;
^
TypeError: Cannot read property 'stdout' of undefined
at compile (C:\Projects\what-now\node_modules\grunt-contrib-compass\tasks\compass.js:37:10)
at C:\Projects\what-now\node_modules\grunt-contrib-compass\tasks\compass.js:68:7
at C:\Projects\what-now\node_modules\grunt-contrib-compass\tasks\lib\compass.js:121:11
at _fileCreated (C:\Projects\what-now\node_modules\grunt-contrib-compass\node_modules\tmp\lib\tmp.js:172:7)
at C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\rimraf\node_modules\graceful-fs\graceful-fs.js:53:5
at C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\rimraf\node_modules\graceful-fs\graceful-fs.js:62:5
at OpenReq.Req.done (C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:142:5)
at OpenReq.done (C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:64:22)
//... stack trace continues ...
Looking at the code that blows up in compass' compile method, what I find is the following:
child.stdout.pipe(process.stdout);
This makes me think that child is undefined for some reason, and this variable comes from a call to grunt.util.spawn. This is where I am at a loss.
Am I missing any dependency? Am I missing any configuration?
Info:
OS: Windows 8 x64
node: v0.10.22
*sighs*, sorry.
All it took me is to write this question to then figure out I needed to have installed Ruby and the compass gem. Now it makes sense: the process for compiling would not spawn up.
After installing Ruby, run:
gem install compass
And you should be good to go.
EDIT: After you install Ruby, you need to make sure that the ruby runtime files' path is added to your PATH variable. (Thanks JagWire!)
On windows i had a few instalations of ruby:
C:\ruby187
and
C:\Ruby200-x64
install compass in both places, using:
gem install compass
this resolve my issue on windows 8 64bit
Following the same procedure for Ember, running grunt. Received the error "TypeError: Cannot read property 'stdout' of undefined." Did gem install compass (ruby had already been installed on my windows 7 64 bit) even though compass was supposed to be installed earlier and this worked. Ran grunt and grunt serve with no problems.

compass:server not found when running `grunt server`

The problem
grunt server outputs this:
Warning: Task "compass:server" not found.
I uploaded Gruntfile.js here: https://gist.github.com/ComFreek/7289648
That's the default file I got after creating a new Yeoman project.
Details
I am reading Building Web Apps With Yeoman And Polymer and following the described console commands to run.
My system:
Windows 8.1 Pro 64-bit
NodeJS 0.10.21
NPM 1.3.11
I've already executed these commands:
npm install -g yo
npm install generator-polymer -g
yo polymer
grunt server told me that I had to install Ruby and Compass.
I installed Ruby from here:
http://rubyinstaller.org/
After installing, I also successfully whether Ruby has really been registered in the PATH.
I used NPM for installing Compass:
npm install grunt-contrib-compass --save-dev -g
(I tried a local and global install of Compass. Neither of them worked.)
This is the exact output of grunt:
D:\test>grunt server
Running "server" task
Warning: Task "compass:server" not found. Use --force to continue.
Aborted due to warnings.
Elapsed time
server 4ms
Total 4ms
It works now...
Unfortunately, I still don't know the exact cause. I went through all of my instructions above again, and it just worked out of the box.
In any case, I recommend updating all packages. My version numbers are (last edited: 02.02.14):
[NodeJS v.0.10.24]
[NPM 1.3.21]
[grunt-cli v0.1.11]
[grunt v0.4.2]
I had the same problem but it was fixed after I've installed Ruby's compass:
# gem install compass
Hint: gem is the package manager for Ruby, so Ruby should be existing in the system.
For Redhat's based linux systems, you can use the following to install Ruby and gem:
# yum install gcc ruby-devel rubygems
# gem install compass
For Debian's based linux systems, you can check this
Install compass with the following command:
npm install -g compass
If you've installed node as a sudo user (which is not recommendable), you should add sudo to the command (and next time use NVM)
sudo npm install -g compass
Install Ruby, add to env -> path variable, add to pathtext as per link below
http://www.tutorialspoint.com/ruby/ruby_installation_windows.htm
Then install compass in ruby.
Only this solved the issue
The only thing that worked for me was:
npm install ruby-compass.
I had previously installed compass like Paul said but didn't work.

Resources