Yeoman for Angular, then "grunt serve" won't start - node.js

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.

Related

Setting up node.js on Ubuntu 12.04 (with eclipse/nodeclipse/enide)

I'm trying to set up node.js on my Ubuntu 12.04 machine. I want to be able to use it through Eclipse but the process seems confusing.
So far what I have done.
Installed node.js. Shows v5.8.0 on running 'node -v'
Installed npm. Shows 3.7.3 on running 'npm -v'
Installed Express using 'npm install -g express'
Added this to my .bashrc file (I've installed node in ~/node)
export PATH=$HOME/node/bin:$PATH
export NODE_PATH=$HOME/node/lib/node_modules
I'm confused about what to do next. I installed Enide Studio 2015 through Eclipse Marketplace.
Switched to the Node perspective.
Created a new Node.js Express Project
But now I don't see the node project structure.
I also get a bunch of errors like:
- Node.js executable can't be found
What am I doing wrong, or what have I not done?
Alternatively, I installed the linux version of enide from here: http://www.nodeclipse.org/
This contains an eclipse file, but on trying to open the eclipse file it says "there is no application installed for executable files". That's strange because my regular install of eclipse opens just fine. Also I'm running a 32 bit system so I've ensured the files are 32 bit, not 64 bit.
Please help!
if you have node and npm working do the following:
Install express generator:
sudo npm install express-generator -g
Read the documentation about the express generator at http://expressjs.com/en/starter/generator.html
Create an express application:
express myapp
Install dependencies:
cd myapp
npm install
Run the application:
npm start
or
node ./bin/www
Open you browser and navigate to http://localhost:3000
Ok figured it out. I had to set up the node.js path in Eclipse under Preferences>Nodeclipse.

Yeoman dependencies for AngularJS project

Using Yeoman and the AngularJS generator I could previously follow their tutorial and install all the necessary packages and tools (bower, gulp, grunt,...) to get up and running. Per their website:
npm install -g yo bower grunt-cli gulp
then added the angularJS project 'generator':
npm install -g generator-angular
created a folder locally, and run
yo angular
in that folder in order to prepare a sample AngularJS project with all the necessary tools and scaffolding generated by Yeoman.
The command:
grunt serve
Launched the sample application successfully, allowing me to start learning about AngularJS (which I'm very new to).
The problem: I have repeated these steps again, (3 months later), and, admittedly, I have potentially taken on updates to some of the installed packages.
Now, when I create a new project and invoke 'grunt serve' I get:
Running "concurrent:server" (concurrent) task
Warning: Running "compass:server" (compass) task
Warning: Command failed: C:\Windows\system32\cmd.exe /s /c "compass.bat --versio
n"
'compass.bat' is not recognized as an internal or external command,
operable program or batch file.
Use --force to continue.
Aborted due to warnings.
and the site does not launch...
Researching this problem, some responses say that I now need to install yet another tool - Ruby, followed by the 'compass' gem.
Is this really necessary ?? (I'm hesitant because the Yeoman website does not require this to get started using the angular generator).
Is there perhaps another solution ?
thanks
It seems like compass is necessary by default.
It also seems that the only solution here is to go ahead and download Ruby (if you do not already have it), in order to install compass. These instructions cover how:
Download Ruby here: http://rubyinstaller.org/downloads/ and install.
Install the compass library: gem install compass
Yes compass is necessary.
Download and install ruby http://rubyinstaller.org/downloads/
and run gem install compass in ruby command prompt to install compass.
now it will work!!!.

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

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.

Karma - config file does not exist

Hi I'm trying to go through the AngularJS original tutorial and in step 2 where I'm supposed to run ./scripts/test.sh, I get an error saying
[ERROR] config - Config file does not exist!
I've checked /config/karma.conf.js and the file indeed does exist.
I'm running the latest version of node, npm, and karma.
I thought re-installing them would fix the issue (as mentioned by a member of the AngularJS team on a Google forum post I found).
I still get the error however. Anyone have any suggestions?
Edit: I tried running /config/karma.conf.js and it gave an error saying "JASMINE is undefined," even though Jasmine is installed. Do I have to set a path or something? I have jasmine installed globally.
You might need to install Karma
steps:
npm install generator-karma
yo karma
If you are on windows try to run ./scripts/test.bat.
On Mac OS Mavericks.
1 - Install Karma
npm install -g generator-karma
2 - run yo karma
yo karma
If node.js and yo is working this will be enough.

Resources