PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 15, 2022

[FIXED] Start a MAMP server with Grunt.js

 February 15, 2022     gruntjs, mamp, workflow, yeoman     No comments   

Issue

I want to set my Grunt.js file to launch my MAMP server on grunt serve.

I have been trying to use this tutorial here to do this:

https://coderwall.com/p/kwne-g

I was then planning to use this tutorial to set up grunt watch:

http://darrenhall.info/development/yeoman-and-mamp

Now I am having trouble with step one. I have successfully installed grunt exec. However, grunt claims not to be able to find the task 'serverup'.

Here is my code:

 grunt.task.run([
        'clean:server',
        'concurrent:server',
        'autoprefixer',
        'connect:livereload',
        'serverup',
        'watch',
        'serverdown'
]);

Solution

If you followed the examples at the link, it looks like your targets should be exec:serverup and exec:serverdown for the tasks to work.

The problem here and with many other Grunt related questions is that without the full Gruntfile, "answers" are largely guesses. Configuration, task loading, and task registration are all related and without seeing all three, it is difficult to say "this is the answer".

Given that, here's a checklist I use for problems like this when using Grunt and packages from NPM:

  1. Is the code that supports the task installed? Did I forget npm install? Did I miss errors on install (check npm-debug.log if it exists)?
  2. Have I correctly used grunt.loadNpmTasks for the plugin? Is the line in my Gruntfile and did I get the plugin name spelled correctly? Did I or my IDE accidentally use to grunt.loadTasks when I need loadNpmTasks?
  3. Have I correctly named/used grunt.registerTask for the task? If I need to call a specific target for a task, do I have the the name correctly specified?
  4. If there are paths involved and things are broken, do I have my globbing patterns correctly specified? If a cwd is involved, do I have the other paths or files correctly specified?
  5. Did I get the configuration right? (This is where things get too plugin-specific for a checklist.)


Answered By - Matthew Bakaitis
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing