Search code examples
node.jsangularjsgruntjsyeomannitrousio

Grunt server not working in nitrous.io


I created a node env using nitrous.io. Inside of their terminal I installed yeoman. If I try to run grunt server I get an error stating:

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

If i go to preview than connect to port 3000 i get this

error message

The Reference states for node to change 127.0.0.1 or "localhost" to 0.0.0.0

  var http = require('http');
  http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
  }).listen(3000, '0.0.0.0');
  console.log('Server running at http://0.0.0.0:3000/');

Grunt syntaxes are a bit different for a server

connect: {
      options: {
        port: 3000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0' // 
      },

Even after this change the errors persist. Failing when I run grunt server or go to preview port 3000

Any ideas on what I'm doing incorrect? How do I run my grunt server so I may see my site in the broswer?


Solution

  • To summarize the comments this worked for me:

    gem install sass; gem install compass
    yo webapp
    

    Edit Gruntfile.js around line 43:

    connect: {
      options: {
        port: 3000, // <- changed this line
        livereload: 35729,
        hostname: '0.0.0.0' // <- changed this line
    

    Run grunt server and click on the Preview-Button / Port 3000.